Help With Online Homework   Contact Us
 


Computer Science 2


Question (5 Credits)

I need computer science tutoring! Here's my computer science homework question:

Write a pseudocode program that computes the sum, average and product of 5 numbers entered by the user and also find the largest and the smallest of the numbers.


Answer

 

Program Compute_Stuff

Function Get_Input
{
Ask user for input of 5 numbers
Read numbers

Function Sum
{
Add numbers input by user
Display message // value of sum on screen
}
Function Average
{
Add numbers input by user
Divide by 5
Display message // value of average of the 5 numbers
}
Function Product
{
Multiply numbers input by user
Display message // value of product of the 5 numbers
}
Function MinMax
{
Initialize Min and Max variables
Loop index i from 1 to 4
{
If i+1>i Then Max=i+1
Else Max =i
If i<i+1 Then Min=i
Else Max =i+1
}
Display message // value of min and max of the 5 numbers


Students: Click here to sign up for a free account