Answer to Question #38706 in C++ for Diamond Griffin

Question #38706
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);

return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS