LabmemNo_012LzTopic @ 2024-02-01 17:03:57
#include <stdio.h>
int main()
{
char c,a[15],k=1,i=0,n=0;
while ((c = getchar()) != '\n')
{
if (c == '-')k = 0;
else
{
a[i] = c - 48;
i++;
}
}
if (k == 0)printf("-");//打印符号
for (int j = i-1; j >= 0; j--)
{
if (a[j] != 0)n = 1;//判断首位是否为零
if(n!=0)
printf("%d", a[j]);
}
return 0;
}