Problem Description
Water problem
Input
Enter a 3-digit number (the title contains multiple sets of test data)
Output
Separates the 3-digit hundred, 10-bit, and single-digit, inverted output (one row of test data per group)
Sample Input
250
Sample Output
052
HINT
Separating out the numbers, you can use the remainder and the divisor.
Note that in C, 2 integers are multiplied except for the result or integer, such as 8/3 in the C language, and the result is 2.
Use symbol% for remainder
For example, the result of 8%3 should be 2 or 8 divided by 3 after the remainder.
1#include <stdio.h>2 3 intMain ()4 5 {6 7 intsplitint,one,ten,hundred;8 9 Ten One while(SCANF ("%d", &splitint)! =EOF) A - { - thehundred = splitint/ -; - -Ten = splitint% -/Ten; - +one = splitint%Ten; - +printf"%d%d%d\n", one,ten,hundred); A at } - - return 0; - -}
Other code:
1#include <stdio.h>2 intMain ()3 {4 intn,m;5 while(SCANF ("%d", &n)! =EOF)6 {7 while(n>0)8 {9m=n%Ten;TenN/=Ten; Oneprintf"%d", m); A } -printf"\ n"); - } the return 0; -}
Wuhan University of Science and technology acm:1003:0 start-up algorithm 14--three-digit inversion