The program should determine the average of a set of numbers entered by the user
ID: 668458 • Letter: T
Question
The program should determine the average of a set of numbers entered by the user in response to prompts from the program and should prompt for the user to enter a number until the user enters a null string. When a null string is entered, the program will determine the average of all the numbers entered so far.
Requirements:
written in C.
Data values should be entered as either integers or floating point numbers (look for text to numeric conversion examples)
Data entry errors (non-numeric values) should result in an error message, not a program crash
If the user enters no valid numeric values before entering a null (pressing “enter”) the program should display an appropriate message
The code shall contain at least one subprogram
The average shall be output as a formatted number
Explanation / Answer
//this program calculates the average of a set of numbers #include using namespace std; int main() { int num = 0; int myArray[100]; int sum = 0; cout > num; for(int i = 0; iRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.