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

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 17:30
Which tab should you open to find the option for adding a header?
Answers: 1
question
Computers and Technology, 23.06.2019 00:00
What engine component is shown in the above figure?
Answers: 1
question
Computers and Technology, 23.06.2019 19:30
What are loans to a company or government for a set amount of time
Answers: 1
question
Computers and Technology, 23.06.2019 20:50
3.11.3 quiz: comparing and analyzing function typesquestion 4 of 102 pointswhat can you say about the y-values of the two functions f(x) = 3x2-3 andg(x)=2* - 3?
Answers: 2
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
question
Mathematics, 18.10.2020 01:01
question
Mathematics, 18.10.2020 01:01
question
Business, 18.10.2020 01:01
question
Mathematics, 18.10.2020 01:01
question
Engineering, 18.10.2020 01:01
question
Biology, 18.10.2020 01:01
Questions on the website: 13722361