#include int main() { int age; char buf[50]; while (1) { printf("How old are you?\n"); if (fgets(buf, 50, stdin) == NULL) exit(0); if (sscanf(buf, "%d", &age) == 1) break; printf("That is not a valid age.\n"); } printf("Big deal, I'm %d\n", age + 3); return 0; }