subject

This program is to read in a list of integers until the value of -999 is input. Complete the program so that it prints out the number of values read, the total of these values, and the average of these values. 1. Declare the proper variables for the number of values (count), total, and average 2. In the while loop, update your variables after reading a new value 3. Calculate the average 4. Display average, count, and total. The printf statements are already given in the base code. The code I need to edit is below in C programming language.

#include

int main (int argc, char** argv)

{

int val;

/* prompt the user for input */

printf ("Enter in a list of numbers followed by the terminal value of -999\n");

/* loop until the user enters -999 */

scanf ("%d", &val);

while (val != -999)

{

scanf("%d", &val);

}

/* calculate the average of the values read in */

/* display the results */

/* use the following printf statements to display the results */

/* remove the comments */

//printf ("For the list of %d numbers with a total of %d\n", count, total);

//printf (" the average is: %15.5f\n", average);

return 0;

}

ansver
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 11:00, abelxoconda
Which are examples of note-taking tools? check all that recording devices sticky notes digital highlighters paper flags highlighting pens digital displays digital flags
Answers: 1
image
Computers and Technology, 23.06.2019 06:30, eddsworldfrantic
You have a small company and want to keep your costs low, but it is important your employees share data. which network would provide you with the most economical solution?
Answers: 1
image
Computers and Technology, 23.06.2019 09:20, lovely222
How to print: number is equal to: 1 and it is odd number number is equal to: 2 and it is even number number is equal to: 3 and it is odd number number is equal to: 4 and it is even number in the console using java using 1 if statement, 1 while loop, 1 else loop also using % to check odds and evens
Answers: 3
image
Computers and Technology, 24.06.2019 10:10, nakeytrag
Which view in a presentation program displays a split window showing the slide in the upper half and a blank space in the lower half?
Answers: 1
You know the right answer?
This program is to read in a list of integers until the value of -999 is input. Complete the program...

Questions in other subjects:

Konu
Social Studies, 25.07.2019 17:30
Konu
Biology, 25.07.2019 17:30