[ create a new paste ] login | about

Link: http://codepad.org/ZkJw3vz0    [ raw code | fork ]

C, pasted on Dec 11:
#include <stdlib.h>

int main(void)
{
    char str[32];
    printf("Please, input number: ");
    fflush(stdout);

    scanf("%s", str);

    int i;
    for(i = 0; str[i] != '\0'; i++) {
        if(str[i] <= '0' || str[i] >= '9') {
            printf("Error occured in index %d: %s\n", i, str);
            exit(EXIT_FAILURE);
        }
    }

    printf("Number: %s\n", str);
    
    return 0;
}


Create a new paste based on this one


Comments: