大佬们能帮我看看这个代码有啥问题吗?
查看原帖
大佬们能帮我看看这个代码有啥问题吗?
950367
joecii楼主2023/3/2 00:29
#include<stdio.h>
#include<string.h>
int main()
{
	int i;
    char str[100];
    scanf("%s",str);
    if(str[0]!='-')
    {
        for(i=strlen(str)-1;i>=0;i--)
        {
            printf("%c",str[i]);
        }
    }
    else
    {
        printf("%c",str[0]);
        i=strlen(str)-1;
        while(str[i]=='0')
            {
                i--;
            }
        for(;i>0;i--)
        {
            printf("%c",str[i]);
        }
    }
    return 0;
}
2023/3/2 00:29
加载中...