All pastes #451476 Raw Edit

Mine

public text v1 · immutable
·published 2007-04-21 15:42 UTC
rendered paste body
#include <stdio.h>


int getnumber(){
        char c;

        int sign=0;
        int sum=0;
        int pos=0;
        while ( ( c=getchar() ) != '\n' )
        {
                if( c >= '0' && c <='9' )
                        sum = 10*sum + (c - '0');

                else
                        if( pos==0 && c == '-' )
                                sign = 1;
                pos++;
        }

        if ( sign )
                return -1 * sum;

        return sum;
}


main(){

        printf("%d", getnumber());
        return 0;
}