Calculate a Ratio in C#

You can simplify fractions by dividing numerator and denominator by their GCD:

var gcd = GCD(A, B);
return string.Format("{0}:{1}", A / gcd, B / gcd)

And a very basic function for calculating the GCD, using the Euclidean algorithm:

static int GCD(int a, int b) {
    return b == 0 ? Math.Abs(a) : GCD(b, a % b);
}

Are you basically trying to get the greatest common denominator - GCD for the two numbers and then dividing them by that and thus getting your string ?

I.e: 800 : 600 ; the greatest common denominator = 200 thus 4:3.

This would be able to deal with all integer numbers. Sorry for not sending the code, but I think that from this on it should be simple enough.

public int GCD(int a, int b)

{
    while (a != 0 && b != 0)
    {
         if (a > b)
            a %= b;
         else
            b %= a;
    }
     if (a == 0)
         return b;
     else
         return a;
}

// Using Konrad's code: 

var gcd = GCD(A, B);
return string.Format("{0}:{1}", A / gcd, B / gcd)

Having played with such things in the past, I'll just add that dealing with signed values can get ugly. Let me suggest that the simplest way to handle signed values is to apply Konrad's approach to the absolute values of your original numbers, then prepend a '-' to the resulting string if the original values have different signs.

Using this approach, the Greatest Common Divisor of -100 and -35 is 5, for a ratio of 20:7. If the original inputs had been either of the pairs (-100 and 35) or (100 and -35), you'd still get a GCD of 5, and an initial result of 20:7, but the final answer would be -20:7 (i.e. standardized form regardless of which input was negative, just as both -6/2 and 6/-2 = -3).