#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 (strcmp(buf, "\n") == 0) { printf("Don't be shy!\n"); } else if (strcmp(buf, "guess\n") == 0) { printf("Ok, I guess 18.\n"); age = 18; break; } else if (sscanf(buf, "%d", &age) == 0) { printf("That is not a valid age.\n"); } else if (age < 0) { printf("A negative age is impossible.\n"); } else if (age < 4) { printf("Unlikely.\n"); } else { break; } } printf("Big deal, I'm %d\n", age + 3); return 0; }