Flowchart that finds the larger of the two numbers
Problem
Design a flowchart that finds and displays the larger of the two numbers provided by the user. Let’s assume the numbers are x and y. The flowchart prompts the user for the values x and y.
IPO chart
Consider modeling an IPO chart for the flowchart before the flowchart design. Think about the input to the flowchart, processing statements, and the output of the flowchart. IPO chart is a handy tool to visualize in a tabular format.
Input | Process | Output |
Input to the flowchart. | Computations that are done in the flowchart. | Output displayed by the flowchart |
Pseudocode
START DECLARE x,y INPUT x INPUT y IF x != y THEN IF x > y THEN DISPLAY "The larger of the two numbers " + x + " and " + y + " is " + x ELSE DISPLAY "The larger of the two numbers " + x + " and " + y + " is " + y END IF ELSE DISPLAY "Both the numbers are equal" END IF END
Flowchart
We will prompt the user to enter two numbers x and y.
We will check if the numbers are equal. If not then we will check for larger of the two numbers.
Sample Output
Let’s run the flowchart with sample test cases to verify that it’s working as intended. If you find that the flowchart is not working as intended in the testing, we may need to verify and debug the flowchart.
Debugging a flowchart: https://www.testingdocs.com/debugging-a-raptor-flowchart/
The larger of the two numbers 7 and 17 is 17
—-Run complete. 9 symbols evaluated.—-
Both the numbers are equal
—-Run complete. 8 symbols evaluated.—-
The larger of the two numbers 89 and 73 is 89
—-Run complete. 9 symbols
Raptor Tutorials on this website can be found at:
https://www.testingdocs.com/raptor-a-flowchart-tool/
RAPTOR official website: https://raptor.martincarlisle.com/