Question
#include int main ( int argc, char ** argv) { int i; int count; int total; int val; double average; /* prompt the user for
#include
int main (int argc, char** argv)
{
int i;
int count;
int total;
int val;
double average;
/* prompt the user for input */
printf ("Enter in a list of numbers followed by the terminal value of -999 ");
/* loop until the user enters -999 */
scanf ("%d", &val);
while (val != -999)
{
total = total + val;
count++;
scanf("%d", &val);
}
/* calculate the average of the values read in */
average = total / count;
/* display the results */
printf ("For the list of %d numbers with a total of %d ", count, total);
printf (" the average is: %15.5f ", average);
return 0;
}
C language
CS 211 - Programming PracticumLab Exercise Name: Acce Spring 2019 NetID: ss the program lablb.c from the Lab Exercises page. This program is to read in a list of integers the value of-999 is input. It then is to print out the number of value read, the total of these values and the average of these values. However, this program does con tain some errors 6. Fill in the table below with the expected values for the variables count, total and average if the program is run with input of 2 4 6 8 -999 Compile and run the program. Fill in the table below with the actual values produced by the program? Expected Value Actual Value Value of variable: count Value of variable: total Value of variable: average Does the program produce the expected output? If not, you may need to fix the error before moving to the next question. rage if the Fill in the table below with the expected values for the variables count, total and ave 7. program is run with input of 2 3 5 -999 ram. Fill in the table below with the actual values produced by the program? Compile and run the prog Expected Value Actual Value Value of variable: count Value of variable: total Value of variable: average Does the program produce the expected output? If not, you may need to fix the error before moving to the next
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