[mod-- Asad, There seemed to be 5 copies of the same message in
your post. I've deleted all but the one where the code was
indented. Regarding the code, I suggest you google greatest
common divisor (gcd) algorithms --mod PN]

hi all,
i made a simple fraction simplifier prog.
but the code doesnt look gud to me.
the code i think can hav a strong logic ....
i will greatly appreciate any different method for fracion solving
using simple loops and if elses nothing advance than that.
thanx in advance!
[compiled on dev c++ 4.9.9.2]

//Authur: ^|X4X|^ Nation
//Email: [email protected]
#include <iostream.h>
#include <conio.h>
main()
{
   int numerator, denominator;
   int count=2;
   cout << "Enter Numerator & Denominator: ";
   cin>>numerator>>denominator;
   if (numerator%denominator==0)
   {
      numerator=numerator/denominator;
      denominator=1;
   }
   else if (denominator%numerator==0)
   {
      denominator=denominator/numerator;
      numerator=1;
   }
   else
   {
   while (count <=100)
   {
      if(numerator%count==0&&denominator%count==0)
      {
         numerator/=count;
         denominator/=count;
         count--;
      }
   count++;
   }
   }
   cout << "Simplifed Fraction Is: " << numerator << " / " << denominator;
        
getche();
}

Reply via email to