运行没错,是哪里的问题求教!!!

P1307 [NOIP2011 普及组] 数字反转

零个灵 @ 2016-11-24 13:55:02

#include<stdio.h> 
int main()
{
    int i=0; 
    char c,a[10];
    c=getchar();
    if(c=='-') putchar(c);
    else a[i]=c;
    while( (i<10)&&(c=getchar())!='\n')
    {    
        i++; a[i]=c; }
    while(a[i]==48) i--;
    while(i>=0) {
        putchar(a[i]);
        i--;}    
    return 0;
}

by Darwin1122 @ 2017-01-12 21:20:24

应该是else a[i]=c-48;


|