/** * conditions-1.c * * David J. Malan * malan@harvard.edu * * Tells user if his or her input is positive or negative. * * Demonstrates use of if-else if-else construct. */ #include #include int main(void) { // ask user for an integer printf("I'd like an integer please: "); int n = GetInt(); // analyze user's input if (n > 0) { printf("You picked a positive number!\n"); } else if (n == 0) { printf("You picked zero!\n"); } else { printf("You picked a negative number!\n"); } }