#include <stdio.h>
int reverse_number(int num) { int reversed = 0;
while (num != 0) {
int remainder = num % 10;
reversed = reversed * 10 + remainder;
num /= 10;
}
return reversed;
}
int main() { int num = 12345; int reversed_num = reverse_number(num); printf("反转后的数字:%d\n", reversed_num);
return 0;
}
标签:10,return,reverse,一个,反转,reversed,整数,int,num From: https://blog.51cto.com/u_16271069/8326354