1 #include <stdio.h> 2 3 int reverse( int number ); 4 5 int main() 6 { 7 int n; 8 9 scanf("%d", &n); 10 printf("%d ", reverse(n)); 11 12 return 0; 13 } 14 15 /* 你的代码将被嵌在这里 */ 16 int reverse( int number ) 17 { 18 int flag = 1; 19 int result = 0; 20 if(number < 0) 21 { 22 flag = -1; 23 number = -number; 24 } 25 do 26 { 27 result = result * 10 + number%10; 28 number = number / 10; 29 }while(number != 0); 30 31 return flag * result; 32 }