Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a pseudocode algorithm whose purpose is to find the maximum, minimum and s

ID: 664753 • Letter: W

Question

Write a pseudocode algorithm 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 pseudo-code will have the following:
-A main function that asks the user for ten marks.
-A function named findMinAndMaxSum that nds 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!

Your main function must call findMinAndMaxSum to obtain the three values, and then print them.


You must write complete algorithms including the algorithm header and algorithm body.

Explanation / Answer

Answer:

Algorithm/Pseudo code for maximum, minimum and sum of collection of numbers

Function findMinAndMaxSum(*Array,*max,*min,*sum, N)

[These parameters are pointers or references, so that modification is effected directly without any return type, N is size of the array]

Step1: Start

2: Set Max:=Min:=Array[0] //get 0th element as initial max and min

3: Set Sum:=0 //sum is intialized with 0

4: Repeat Step 5 to 9 For i:=0 to N step 1 //loop for repeating

5: If *Max<Array[i] Then //getting maximum

6: *Max:=Array[i]

7: If *Min>Array[i] Then //gettting mininum

8: *Min:=Array[i]

[End If]

9: Set *Sum:=*Sum+Array[i] //Calculate each element sum

[End For]

10: Stop

Function Main():

Step1: Start

2: Declare Array[]={90,3,2,89,-4,66} //Set array values/list

3: Declare Max,Min,Sum

4: Call findMinAndMaxSum(Array,&Max,&Min,6) //& is address operator for reference

5: Print Max,Min, Sum //print modified 03 variables

6: Stop

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote