/* * Extremely simple (and silly) example of conditional execution. */ #include int main(void) { int x = 5; printf("enter x\n"); /* * somewhat cryptic but C-idiomatic way to check whether scanf * was able to get an integer from user input */ if (scanf("%d", &x) != 1) { printf("not number\n"); return 1; } if (x < 0) { printf("%d negative\n", x); } else if (x > 0) { printf("%d positive\n", x); } else { printf("zero\n"); } if ((0 <= x) && (x <= 10)) { printf("in range\n"); } return 0; }