Access the program lablb.c from the Lab Exercises page. This program is to read in a list of integers until the value of -999 is input. It then is to...
#include <stdio.h>
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 -999n");
/* 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 %dn", count, total);
printf (" the average is: %15.5fn", average);
return 0;
}
Access the program lablb.c from the Lab Exercises page. This program is to read in a list of integersuntil the value of -999 is input. It then is to print out the number of value read. the total of these valuesand the average of these values. However, this program does contain some errors. 6. Fill in the table below with the expected values for the variables count, total and average if theprogram is run with input of: 2468-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 tothe next question. 7. Fill in the table below with the expected values for the variables count, total and average if theprogram is run with input of: 2 3 5 -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 tothe next question.
Show more