How to create a Flow Chart for sum of squares for N integers?
Document Contents
Introduction
The raptor Flow chart enables you to create executable flowcharts. Mathematical notation for the sum of squares is shown:
Mathematical Notation
Mathematical notation for the sum of squares up to n numbers is:
or in simple notation
Test Case Scenario | Detailed Steps | Test Data | Expected Result | Actual Result |
Find the sum of squares of N integers. |
|
10 | 385 | To be filled after executing the flowchart. The actual result should match the expected result. |
Steps to build
Raptor flow chart steps for the program is shown below:
Start the Raptor flowchart tool.
You would be provided with a flowchart with Start and End symbols.
Save the flowchart with a name.
Add Assignment symbols for Assignment( left-clicking once on the symbol and then adding it between Start and End.)
i <- 1
sum <- 0
series <- ” ”
Add Input symbol to the flowchart. Double click to add the prompt “Enter number” and use the variable name N.
Loop Structure
Add a loop structure to the flow chart.
https://www.testingdocs.com/questions/how-to-add-repetition-structure-to-the-raptor-flowchart/
Edit its expression to
i > N
In the loop structure for NO decision, do the following things:
Add Assignment symbols to the flowchart to the flowchart for sum, series and i
sum <- sum + ( i* i )
series <- series + ” ” + ( i*i )
i <- i + 1
Add an Output symbol to the flowchart to output series
series <- series + ” ” + ( i*i ) statement is just to print the series to the output console window.
Flowchart
Raptor Flow chart Sum of squares
In the loop structure for YES decision,
Add an Output symbol to the flowchart to output the sum
Once you are done with a flow chart, You can execute the Raptor flow chart by clicking on Execute to completion button. You can verify the inputs and outputs in the run. ( Explore Run menu options for more details). While designing the flow chart you can even test and debug using the “Step to Next shape” button.
Screenshot
Sample Output of the Flowchart
Series= 1
Series= 1 4
Series= 1 4 9
Series= 1 4 9 16
Series= 1 4 9 16 25
Series= 1 4 9 16 25 36
Series= 1 4 9 16 25 36 49
Series= 1 4 9 16 25 36 49 64
Series= 1 4 9 16 25 36 49 64 81
Series= 1 4 9 16 25 36 49 64 81 100
Sum of squares:385
More Flowchart Examples
https://www.testingdocs.com/raptor-flowchart-examples/
Raptor Tutorial
Raptor Tutorials on this website can be found at:
https://www.testingdocs.com/raptor-a-flowchart-tool/
RAPTOR official website: https://raptor.martincarlisle.com/