Mixed Fractions
Limits
1s, 512 MB
Given an improper fraction (as the numerator N and the denominator D), determine and print it in mixed fraction form.
Here are a few examples of improper and mixed fractions:
Here are a few examples of improper and mixed fractions:
Improper | Mixed |
---|---|
Input
The input will contain two integers N (1 < N < 100) and D (1 < D < N).
All test cases will always produce a valid mixed fraction.
All test cases will always produce a valid mixed fraction.
Output
Print three integers: the whole number, the numerator and the denominator of the mixed fraction, each separated by a space.
#include<stdio.h>
int main()
{
int n,d;
scanf("%d %d", &n, &d);
printf("%d %d %d\n",n/d,n%d,d);
return 0;
}