1 2 3 4 5 6 7 8 9 10 11 12 13
#include <stdio.h> getnum() { int c, n; n = 0; while ((c=getchar()) >= '0' && c <= '9') n = n*10 + c - '0'; if (c == EOF) return(-1); return(n); }