A good answer might be:
Only the true-branch was executed because the answer to the questionEnter an integer: -5 The number -5 is negative Good-by for now num < 0 was true.
|
Simulated ProgramHere is a simulation of this program (using JavaScript and your browser). Of course, for maximum benifit you should "copy-paste-save-and-run" the real program. But, play with the following if you want. Perform the steps 1, 2, and 3 under the simulated monitor as many times as you want. (Note: if this does not work, your browser does not have JavaScript enabled. Skip this and go on the the next page.) This is just a simulation (using JavaScript), so it is not exactly like a compiling and running a real Java program. Don't take it too seriously. Please do the real thing if you can. |
QUESTION 5:Try the program (or look at the flowchart) with the value 0 (zero). What is the output? Click Here after you have answered the question |