Input a three-digit positive integer, output in reverse, if there is 0 in the ten digit or each digit, it will not output

Input a three-digit positive integer, reverse output, such as input 123, output 321. (5 points) Topic content: Input a three-digit positive integer and output it in reverse, for example, input 123 and output 321.

Input format:
a three-digit positive integer

Output format:
output the number in reverse, if it starts with 0 after reverse, then 0 will not be output.
Input sample 1:
103

Output sample 1:
301

Input example 2:
120

Output sample 2:
21

C语言
#include<stdio.h>
main()
{
int n,a,b,c;
scanf("%d",&n);
a=n/100;
b=(n/10)%10;
c=n%10;
if(b!=0&&c0)
{printf("%d%d",b,a);}
else if(b
0&&c==0)
{printf("%d",a);}
else
{printf("%d%d%d",c,b,a);}
return 0;
}

Guess you like

Origin blog.csdn.net/Cassie133321/article/details/105552320