write a program that reads and prints the average of numbers input by a user. yo
ID: 3623602 • Letter: W
Question
write a program that reads and prints the average of numbers input by a user. you do not know the numbers and how many numbers. your program must follow this procedure: a) print the statement "specify a number", b) request input from a user, c) if teh user specifies a number other than 'NaN', add the number to the array storing the numbers, and then go to step (a) to request another number. if teh user enters 'NaN', print the statement "End of Data Input" and go to step (d), (d) calculate the average of the numbers, (e) print out the following statements: 'you entered n numbers', 'the number you entered were: _,_,_,.,'the average of numbers is'Explanation / Answer
j = [] arr = [] while true j = input('specify a number ') if j == 'NaN' break end arr = [arr, j] end display('the numbers you entered were') display(arr) display('the average is') display(mean(arr))
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.