Write a pseudocode algorithm (not actual C++ code) whose purpose is to find the
ID: 664679 • Letter: W
Question
Write a pseudocode algorithm (not actual C++ code) whose purpose is to find the maximum, minimum and sum for a collection of numbers. To practice the concepts of local scope, references, and functions, your pseudocode will have the following:
o A main function that asks the user for ten marks
o A function named findMinandMaxSum that finds the lowest and highest of all the marks, and the sum of all elements and returns them through reference parameters. This function cannot display or print anything!
o Your main function call findMinandMaxSum to obtain the three values, and then print them.
You must write complete algorithm including the algorithm header and algorithm body
Explanation / Answer
Pseudocode:
start
Declarations
num SIZE=10
num marks[SIZE]
num min
num max
num sum
num i
test=findMinandMaxSum()
output test.min,test.max,test.sum
stop
findMinandMaxSum()
min=0
max=0
sum=0
i=0
Check (i<10) then
if(i==0) then
min=marks[i]
max=marks[i]
end if
if(marks[i]>max)
max=marks[i]
end if
if(marks[i]<min)
min=marks[i]
sum=sum+marks[i]
end if
return max, min,sum
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.