Write the algorithm and pseudocode for finding the average of five(5) numbers.
Algorithm:
Step 1 Create variable called number
Step 2 Create variable called sum
Step 3 Create variable called average
Step 4 for i := 1 to 5 Step 1 do
Step 5 Get number from the user
Step 6 sum := sum+ number
Step 7 average := sum/5
Step 8 Display average
Pseudocode:
Start
number = 0
sum =0
average= 0
for i = 1 i<= 5
Display message: "Enter the number: "
Input number
sum = sum + number
average = sum / 5
Display message: "Average is: ", average
Stop
Comments
Leave a comment