In this post, we will learn how to design a flowchart with the selection symbol. We can execute the if-then flow using the selection symbol in the Raptor flowchart. Example in the post to decide a given number Positive or Negative number.
This is similar to what we do in the code using the if-then statements to make decisions. A selection-control symbol allows you to make decisions in the flowchart.
Print the number if its positive or negative number.
Output : 56 is a positive number.
Input : -45
Output : -45 is a negative number.
Steps to create the flow chart:
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