go to previous page   go to home page   go to next page hear noise highlighting

Answer:

-12 is negative.


Number Tester

flowchart of two way decision

An integer may be negative, or not. If it is not negative, then it is positive or zero. Here is that idea expressed as a flow chart:

The diamond box shows a two-way decision. Either the false branch or the true branch is taken depending on whether

num < 0

is true or false.

The "two-way split" of the program is easy to see in a two dimensional chart. It is harder to see this in a program where line follows line one after another. The flow chart shows the overall logic of the program. Most of the details of syntax are left out. It is often helpful to sketch a flowchart when you are designing a program. You can use the flowchart to get the logic correct, then fill in the details when you write the program.


QUESTION 5:

The user runs the program and enters "12". What will the program print?


go to previous page   go to home page   go to next page