The following statement prints “You lose!” on the screen; int num = -1; if (num) printf("Bingo!"); else printf("You lose!");
查看答案
What will the following program print on screen? int age = 0; if (age = 40) printf("Happy Birthday!"); else printf("Sorry");
A. Happy Birthday!
B. Runtime error.
C. Sorry
D. Nothing; the program will not compile.
What will the following program print on screen? int age = 40; if (40 = age) printf("Happy Birthday!"); else printf("Sorry");
A. Happy Birthday!
B. Runtime error.
C. Sorry
D. Nothing; the program will not compile.
What will the following program print on screen? int tenure = -10; if (tenure + 5) printf("Congratulations!"); else printf("Sorry");
A. Congratulations!
B. Runtime error.
C. Sorry
D. Nothing; the program will not compile.
In a switch statement, if the break statements are omitted, all cases following the matching case value, including the default case, are executed.