Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C PROGRAMMING Create a program that adds positive real numbers (double) entered by the user until the user enters a negative number. The program calculates
C PROGRAMMING
Create a program that adds positive real numbers (double) entered by the user until the user enters a negative number. The program calculates the average of the entered positive numbers and prints the average to two decimal places. (Also try how the program behaves when you "forget" to read the data in front of the variable name.) Execute the program with the while structure. The program checks whether the user enters data that can be interpreted numerically. If the user enters incorrect information, the program will ask for the number again. If the user enters an incorrect input three times, the program notifies the user of the failure of the input number and the program is stopped. Example of running invalid inputs (normal case is similar to previous tasks): Enter a real number (negative value terminates)> adf There was no real number There was no real number There was no real number Invalid entry number 1 Invalid, please try again! > d There was no real number Invalid entry number 2 Invalid, please try again! > g There was no real number Invalid entry number 3 Invalid input three times. The program is terminated
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started