香蕉君_ @ 2017-11-10 20:14:03
#include "stdlib.h"
#include<stdio.h>
#include "math.h"
int main()
{
int a;
int buf[10];
int i = 0,length=0,j;
int num=0;
int pow = 1;
printf("请输入一个数字\n");
scanf("%d",&a);
printf("你输入的数字为:%d\n",a);
while (a!=0)
{
buf[i] = a % 10;
i++;
a /= 10;
}
length = i;
for (i=0; i < length-1; i++)
if (buf[i] != 0)
break;
for (j = length -1; j >= i; j--)
{
num += buf[j] * pow;
pow *= 10;
}
printf("倒置后的数字为%d\n",num);
return 0;
}
by __世界第一弱__ @ 2017-11-10 20:17:45
by 蒟蒻lxy @ 2018-12-02 21:07:27
printf("请输入一个数字\n");
printf("你输入的数字为:%d\n",a);
printf("倒置后的数字为%d\n",num);