Three digits in reverse order (Exercise on the first day), exercise on the first day of Reverse Order
Subject content:
Each time the program reads a positive three-digit number, it then outputs a number in reverse order. Note: When the input number contains 0 at the end, the output should not contain 0 at the beginning. For example, if the input value is 700, the output value is 7.
Input Format:
Each test is a three-digit positive integer.
Output Format:
Number of output reverse orders.
Input example:
123
Output example:
321
Time Limit: Ms memory limit: KB
Program reference:
# Include <stdio. h>
Int main ()
{
Int x;
// Read three digits
Scanf ("% d", & x );
// Split the three-digit, ten-digit, and hundred-digit
Int g = x % 10;
Int B = x/2/100;
Int s = x/10-b * 10;
// Calculate the descending order of three digits
Int y = g * 100 + s * 10 + B;
// Output
Printf ("% d", y );
Return 0;
}
Thoughts:
I learned the questions I encountered on the first day of C language. (Learning content: output, variables, and simple computing)
When I first got a question, I was overwhelmed to describe it. After careful analysis, I found that it was not difficult. I think that in C language learning, thinking is very important.