Number Positive or Negative flowchart in RAPTOR

Introduction

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.

Basic Mathematics

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.

Number positive or negative

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

Input Symbol

Drag and drop one Input symbol for the user prompt.

https://www.testingdocs.com/raptor-flowchart-basics-input-and-output/

 

 

Selection Symbol

Now we need one Selection symbol. Drag and drop the selection symbol.

Double click on the diamond box n < 0

https://www.testingdocs.com/questions/how-to-use-selection-symbol-in-raptor-flowchart/

 

 

 

Ouput Symbol

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.
For example:
Input: 56

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/