96.7k views
2 votes
Write the pseudocode to input 5 numbers from the keyboard and output the result​

User ThisLanham
by
7.7k points

1 Answer

2 votes

Answer:

Step-by-step explanation:

// Initialize variables

total = 0

counter = 1

// Loop to get 5 numbers

while counter <= 5 do

// Get input from user

input_number = input("Enter number " + counter + ": ")

// Convert input to a number

number = parseFloat(input_number)

// Add number to the total

total = total + number

// Increment counter

counter = counter + 1

end while

// Calculate the average

average = total / 5

// Output the result

print("The total is: " + total)

print("The average is: " + average)

User Chao Ruan
by
8.6k points