求指正!!!

P1307 [NOIP2011 普及组] 数字反转

aoaoaomio @ 2017-10-05 22:37:09

#include<stdio.h>
#include<math.h>
int main()
{
    long int N,b,c,d,f;
    int i,n;
    scanf("%ld",&N);
    c=0;
    if(N<0)d=b=-N;
    else d=b=N;
    while(b/10>0)
    {
        n=n+1;
        b=b/10; 
    }
    for(i=0;i<=n;i++)
    {
        f=pow(10,n-i);
        c=c+(d%10)*f;
        d=d/10;
    }
    if(N<0)c=-c;
    printf("%ld",c);
    return 0;
}

|