Tuesday, November 30, 2010

REDUCED TERMS OF GIVEN RATIONAL NO

//sample i/p: 10/20
//sample o/p: 1/2
void main()
{
int rem,num1,num2,i;
printf("enter the numerator and denominator");
scanf("%d%d",&num1,&num2);
for(i=2;i<10;i++)
{
num1/=i;
num2/=i;
}
printf("%d /%d",num1,num2);
getch();
}

No comments:

Post a Comment