Question: Write a program that repeatedly asks the user to enter a number, either float or integer until a value -88 is entered. The program should

Write a program that repeatedly asks the user to enter a number, either float or integer until a value -88 is entered. The program should then output the average of the numbers entered with two decimal places. Please note that -88 should not be counted as it is the value entered to terminate the loop. (5) A sample run: Enter a number(integer or float):5 Enter a number(integer or float):3.2 Enter a number(integer or float):2.1 Enter a number(integer or float)-88 The average of 5 numbers entered is 3.43 Step 1: To repeatedly asks the user to enter a number, you will need a WHILE loop, -88 should be used as the condition to stop the while loop Step 2: To calculate the average of the numbers, you will need to declare a COUNTER and a TOTAL and a NUMBER for the user input, before the WHILE loop starts Step 3: Inside the WHILE loop TOTAL should be calculated as TOTAL +NUMBER, and COUNTER should be incremented by 1 each time Step 4: Once WHILE loop stops, Average should be calculated as TOTAL/ COUNTER Step 5: Print out the result
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
