Flowchart to calculate total and average of array elements
Flowchart to calculate total and average of array elements
In this flowchart, we will compute the total and average of the array elements. Total is the sum of all the elements in the array. Average is total divided by the number of elements in the array.
To read values into an array, follow the link:
https://www.testingdocs.com/questions/how-to-read-values-into-an-array-using-raptor-flowchart/
Pseudocode
Average(marks) DECLARE total DECLARE index total = 0 index = 1 DO UNTIL index > 5 total = total + marks(index) index = index + 1 LOOP OUTPUT "Total Marks =" + total OUTPUT "Average :=" + (total / Lenght_of(marks)) END
Flowchart
We will take the marks array in this example. marks array holds 5 subject marks of the student Alice.In this flowchart we will compute the total marks and the average.
Inside the loop, we will accumulate the sum of the array elements:
total <- total + marks[index]
After the loop we will output the total marks and calculate the average.
Average <- total/length_of(marks)
RAPTOR Tutorials on this website can be found at:
https://www.testingdocs.com/raptor-a-flowchart-tool/
For more information on RAPTOR, visit the official website at: https://raptor.martincarlisle.com/