时空之影 @ 2018-07-24 16:41:41
int main() { int n; scanf("%d", &n);
if (n == 0) {
printf("0"); //如果是零,则输出'0',结束程序
return 0;
}
if (n < 0) {
printf("-"); //如果是负数则先输出'-'
n = -n;
}
while (n % 10 == 0) n /= 10; //去掉末尾的零
while (n > 0) {
printf("%d", n % 10); //逆序输出
n /= 10;
}
}
by 2017zc @ 2018-07-24 16:44:05
左转markdown学习,thanks
by saberKnight @ 2018-09-21 13:18:55