Flowchart to find the smallest among 3 numbers?
Overview
In this tutorial, we will create a RAPTOR flowchart to find the smallest among 3 numbers. The flowchart will prompt the user to enter the three numbers.
Environment:
- RAPTOR flowchart software
- Windows 10 operating system
Steps to create
Follow the below steps to create the flowchart using RAPTOR:
Launch RAPTOR flowchart software.
Create and save the flowchart.
Declare three input variables a, b, and c to store the three numbers.
Prompt the user to enter the three numbers using the Input symbol. We will assume that the user will input valid and unique numbers.
Print the number on the output console using the Output symbol. The + operator in the output symbols is used for the string concatenation operator. The + operator joins two strings into one combined string.
Compare two numbers( a, b) initially with an IF selection control. The IF control has two branches: the Yes branch and the No branch. If the condition in the IF is True, the Yes branch will be executed. If the condition is False, the NO branch will be executed.
Initially, we will check if a < b in the outer If control. We nest another If selection symbol in the Yes and No branches to compare with the other number.
For example, if a < b is True and a < c is True, then a is the smallest number.
RAPTOR Flowchart
Flowchart Output
Save the flowchart and run the flowchart. Menu option Run >> Execute to Completion
Enter three numbers and verify the output. For example, let’s enter
- a = 5
- b = 7
- c = 9
Flowchart output:
The numbers are a= 5, b= 7 , c= 9
5 is the smallest number
Sample Code
The pseudocode for the flowchart is as follows:
/** * NAME: * DATE: * FILE: * COMMENTS: */ START DECLARE a,b,c INPUT a INPUT b INPUT c IF (a < b) { IF (a < c) { PRINT a + " is the smallest number"; } ELSE { PRINT c + " is the smallest number "; } } ELSE { IF (b < c) { PRINT b + " is the smallest number"; } ELSE { PRINT c + " is the smallest number"; } } END
That’s it. We have successfully designed a RAPTOR flowchart to find the smallest of the three numbers.
—
RAPTOR Tutorials
Raptor Tutorials can be found here on this website.