Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please give me the code in C Description: This assignment is to write a program to read unknown number of scores (double type) from the

image text in transcribedimage text in transcribed

Please give me the code in C

Description: This assignment is to write a program to read unknown number of scores (double type) from the keyboard and calculate the sum and average of the scores. The program will repeatedly read positive scores until it reads a non-positive number, such as 0 or negative values. After reading the non-positive score, the program should output the sum and the average to the screen. Make sure the last input will not be part of the result. For example, if the user enters -12 to quit (as below), then -12 should not be part of the calculation. You don't need to use an array to store all the scores (we haven't learned it so far, but most importantly, it is not necessary!). Use variables to store the sum and number of scores as you read (read the textbook if you don't know how to do it!), and calculate the average after the user enters the non- positive value. Program Output: >run Enter a positive score (0 or negative to quit): 90.1 Enter a positive score (0 or negative to quit) 92 Enter a positive score (0 or negative to quit): 93.5 Enter a positive score (0 or negative to quit) -12 The sum is: 275.60, average is: 91.87 If no one invalid input at all, then output "No sum and average calculated! " with a new line ore quit the program. rur Enter a positive score (0 or negative to quit): -12 No sum and average calculatedi

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

Knowledge Discovery In Databases

Authors: Gregory Piatetsky-Shapiro, William Frawley

1st Edition

0262660709, 978-0262660709

More Books

Students also viewed these Databases questions

Question

What is Accounting?

Answered: 1 week ago

Question

Define organisation chart

Answered: 1 week ago

Question

What are the advantages of planning ?

Answered: 1 week ago

Question

Assess three steps in the selection process.

Answered: 1 week ago

Question

Identify the steps in job analysis.

Answered: 1 week ago