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
Expert's answer
#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 first!

Leave a comment

Ask Your question

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS
paypal