Answered step by step
Verified Expert Solution
Link Copied!

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Programming The Perl DBI Database Programming With Perl

Authors: Tim Bunce, Alligator Descartes

1st Edition

1565926994, 978-1565926998

Students also viewed these Databases questions

Question

Which form of proof do you find most persuasive? Why?

Answered: 1 week ago