Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#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;

}

image text in transcribed

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

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_2

Step: 3

blur-text-image_3

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

Current Trends In Database Technology Edbt 2004 Workshops Edbt 2004 Workshops Phd Datax Pim P2panddb And Clustweb Heraklion Crete Greece March 2004 Revised Selected Papers Lncs 3268

Authors: Wolfgang Lindner ,Marco Mesiti ,Can Turker ,Yannis Tzitzikas ,Athena Vakali

2005th Edition

3540233059, 978-3540233053

More Books

Students also viewed these Databases questions

Question

6. Conclude with the same strength as in the introduction

Answered: 1 week ago

Question

7. Prepare an effective outline

Answered: 1 week ago