Rookie_1st @ 2024-09-05 22:11:16
#include<stdio.h>
#include<string.h>
int main()
{
char a[11];
int len,i;
scanf("%s",a);
len=strlen(a);
if(a[0]==0) return 0;
if(a[0]=='-')
{
printf("-");
for(i=len-1;i>=1;i--)
{
if(a[i]!='0')
break;
}
for(;i>=1;i--)
{
printf("%c",a[i]);
}
}
else
{
for(i=len-1;i>=0;i--)
{
if(a[i]!='0')break;
}
for(;i>=0;i--)
printf("%c",a[i]);
}
return 0;
}
by xxr___ @ 2024-09-05 22:29:11
0的情况
by xxr___ @ 2024-09-05 22:29:47
0的时候应该输出0你直接return 0了
by xxr___ @ 2024-09-05 22:30:09
@Rookie_1st 0
by Rookie_1st @ 2024-09-06 00:33:24
@tomxi @tomxi 低级小错误哎,谢谢哥~