Sum of Squares of Array Elements [ 2024 ]
Sum of Squares of Array Elements
In this tutorial, we will design a RAPTOR flowchart to compute the sum of squares of given array elements. The user enters the numbers.
Problem Statement
Compute the sum of squares of the user-given numbers. Let a1, a2, …..an are the numbers.
Sum = a1^2 + a2^2 + a3^2 + ….. + an^2
Input
The input to the flowchart from the user:
- Array size
- Array elements
We will use the array to store the numbers.
RAPTOR Flowchart
The flowchart uses a modular approach. The flowchart is divided into smaller problems and appropriate sub-modules/functions would be designed to accomplish the tasks. The main flowchart invokes the other sub-modules. The main function uses three procedures.
- Populate_Array()
- Print_Array()
- Compute_SumSquares()
The Populate_Array() function creates and populates the array of a given size with the user input numbers.
Print Array Elements
The Print_Array() function prints the array elements on the output console.
The Compute_SumSquares()Â function computes the sum of the square of the array elements and prints the sum on the output console window.
Sample Output
Save the and run the flowchart. Enter the array size and the numbers. The numbers will be stored in the array.
That’s it. Using a modular approach, we have successfully designed a RAPTOR flowchart to compute the sum of squares of the given numbers.
—
RAPTOR Tutorials
Raptor Tutorials on this website can be found at:
RAPTOR official website: