7-3 reverse three digits

Each time the program reads a number of bits n 3, and then outputs a digital bit inversions. Note: When the end containing the digital input 0 output 0 not with preamble. Such as input 700, the output should be 7.

Input formats:

Each test is a positive integer of 3.

Output formats:

The number of output bit reverse order.

Sample input:

123

Sample output:

321


First let me own, write a little extra lengthy, too lazy to change it. . Can be a little, read other people's, concise, and impress friends.

 1 #include<stdio.h>
 2 int main(){
 3     int arr=0;
 4     int i=0;
 5     scanf("%d",&arr);
 6     int q[3]={0};
 7     
 8     q[2]=arr/100;        
 9     q[0]=arr%10;    
10     q[1]=(arr-q[2]*100-q[0])/10;    
11 
12     for(i=0;i<2;i++){
13         if(q[i]!=0)
14             printf("%d",q[i]);
15     }
16     printf("%d",q[2]);
17     
18     return 0;
19 } 

https://blog.csdn.net/iamyococo/article/details/41660221 this is someone else's, you can see

Guess you like

Origin www.cnblogs.com/xly1997/p/11229368.html