but the code doesnt look gud to me.
i will greatly appreciate any diff method for fracion solving
using simple loops and if elses nothing advance than that.
//I skiped your "if (numerator%denominator==0)" part becouse the folowing code already covers that
for(int count = numerator<denominator ? numerator : denominator; count>1; count--){
// your code would not simplify 303 / 202 becouse it only looked to divisors up yo 100
// yet max divisor may be the up to the lesser of the two numbers;
if(numerator % count == 0 && denominator % count == 0){
numerator /= count;
denomirator /= count;
break;//added break so thar division is performed only once. note that in this code count is decreasing.
}
}
Google "greatest common divisor", or else look it up on wikipedia. Wikipedia gives you C code
to compute the GCD. To reduce a fraction a/b, you simply divide both a and b by GCD( a, b ).