In this post, we will learn how to design a flowchart to decide if the user entered number is negative or positive. The flowchart uses the Selection symbol. A selection-control symbol allows you to make decisions in the flowchart.
n < 0 n is negative.
If the given number is less than 0 -> the number is negative.
n > 0 n is positive.
If the number is > 0 the number is positive.
Zero is a special case.
Create RAPTOR flowchart:
Launch the RAPTOR flowchart tool.
We need a variable to hold the user entered number.
Let us call it n.
Drag and drop the Assignment symbol.
n <- 0
Drag and drop one Input symbol for the user prompt.
Now we need one Selection symbol. Drag and drop the selection symbol.
Double click on the diamond box n < 0
Drop two Output symbols in the Yes path flow and the other in the No path flow.
In the Yes path output the number is negative.
In the No path add another selection to decide zero or positive.
Execute and Test the flowchart.
Flowchart run output
Example Flowchart Output
Print the number if its positive or negative number.
Output : 56 is a positive number.
Input : -45
Output : -45 is a negative number.
This is similar to what we do in programming code using the if-then statements to make decisions. We can execute the if-then flow using the selection symbol in the Raptor flowchart.
RAPTOR tutorial page: https://www.testingdocs.com/raptor-a-flowchart-tool/
Flowchart examples: https://www.testingdocs.com/raptor-flowchart-examples/
RAPTOR official website: https://raptor.martincarlisle.com/