Hi guys! i am stuck in my fraction program. i hope you guys can solve it. here i have posted my code. i am trying to get for e.g. 4/2 need to get me answer like 2/1 or 2/4 show me 1/2. i hope you can help me out. i will really appreciated. thank you
void fraction(int n, int d){
int i,j;
for(i=1;i<=d;i++)
if(n%i==0)
n = n/d;
for(j=1;j<=d;j++)
if(d%j==0)
d = d/n;
cout << n << "/" << d;
}