Site icon TestingDocs.com

Sum of Squares of Given Array Elements

Overview

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:

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.

 

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. We have successfully designed a RAPTOR flowchart to compute the sum of squares of the given numbers using a modular approach.

RAPTOR Tutorials

Raptor Tutorials on this website can be found at:

https://www.testingdocs.com/raptor-a-flowchart-tool/

RAPTOR official website:

https://raptor.martincarlisle.com/

Exit mobile version