Create a program that asks the user for two integers which represent the numerator and denominator parts of fraction.
Print out a simplification of the fraction.
Example:
Enter the numerator: 22
Enter the denominator: 5
22/5 is 4 and 2/5
1
Expert's answer
2014-01-28T13:31:01-0500
#include <stdio.h>
int main() { int numerator, denominator;
scanf("%d %d",&numerator, &denominator);
printf("%d/%d is %d and %d/%d", numerator, denominator, numerator/denominator, (numerator%denominator), denominator);
Comments
Leave a comment