That’s right.
int n,a,b,c; 4 integer variables are defined, where n is the number to be entered, a is the hundreds digit of the entered number, and b is the tens digit of the entered number. number, c is the single digit of the entered number.
scanf("%d",&n); Gets the number entered by the keyboard. Assume that 123 is entered, and the value of n is 123.
a=n/100; To obtain the hundreds digit, use 123 to divide 100. At this time, you get 1, that is, the value of a is 1.
c=n%10; To obtain the single digit, divide 123 by 10 to perform the remainder operation, and the remainder is 3, that is, the value of c is 3.
b=(n-a*100)/10; To obtain the tens digit, use (123-1*100) to perform an integer division by 10, and the b value is 2.
printf("%d\n",c*10b*1a); Finally output in reverse order, the previous number c becomes hundreds, that is, c*100
The previous tens digit is still a tens digit, that is, b*10
The previous hundreds digit becomes a single digit, that is, a
Add the three , that is, the three-digit number in reverse order is obtained.
That is, 3*102*11=321
This question is actually very simple. The key is how to obtain the number in each digit of the three-digit number. Experience it.