1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
MArishka [77]
4 years ago
10

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 n

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

}
Computers and Technology
1 answer:
kvv77 [185]4 years ago
7 0

Answer:

#include <stdio.h>

int main()

{

   int val, total = 0, count = 0;

   float average = 0;

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

   scanf ("%d", &val);

   while (val != -999){

   

       if(val != -999){

           total += val;

           count++;

       }

       

       scanf("%d", &val);

   }

   

   average = (float)total / count;

   

   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;

}

Explanation:

Declare the total, count and average variables

In the while loop:

Add the entered number to the total and increment the count by 1 unless it is -999

Calculate average, divide total by count (Typecast the total as float to get decimal result)

You might be interested in
Visual-verbal synergy has nothing to do with text, but solely with images used in a design.
Ilia_Sergeevich [38]
I think it is true (A) 
3 0
4 years ago
This tag element is the last one used in the html code sequence
satela [25.4K]

Answer:

Looking closely at the HTML code sequence, it does seem that the tag element is the endpoint from where the HTML form gets the input, like input boxes, checkboxes, radio buttons, etc. And hence it is correct to say that the tag elements are the last one used in the HTML code sequence. And in the HTML code sequence head title script and styles comes at the top, and hence we mention the script or the Javascript code basically at the last, such that the HTML code or the web page run one time at least.

Explanation:

Please check the answer section.

3 0
4 years ago
Aurelia is designing a user interface for a new game app. Which of the following should she taken into consideration for the use
serious [3.7K]

Answer:

C

Explanation:

what types of loop will be used.

4 0
3 years ago
Because it allows their files to be accessed from any device on the Internet, many users like to back-up their files using ___ s
77julia77 [94]

Answer:

Cloud

Explanation:

Cloud computing is a central form of storing data on a data center, provided online, to provides inexpensive and secure storage facilities and central accessing of document, using any device and accessing the data from anywhere and time.

Data stored in a clients computer system, would have to be transferred to another remote computer by using a portable storage, to share data. Using a cloud service or a database center service, a document can be accessed by a group of users at the same time, in different places, and assures a secure data in the database.

3 0
3 years ago
Which formula is properly constructed
kirill115 [55]

Answer:

Option 4 is correct ,=(B2+C9)

Explanation:

In excel a formula starts with an equal sign followed by the expression.

In first option the formula is incorrect inside the brackets. where 4 is equating to bracket. In 2nd option opening and closing brackets are not same. First closing bracket is missing an opening bracket. In third option all the formula is correct except the part where # is used in formula. Hash tags cannot be used in formula as a value. Here in option D  B2 and C9 are cell in excel, whereas parentheses are only used for better readability.

7 0
3 years ago
Other questions:
  • For any element in keysList with a value greater than 50, print the corresponding value in itemsList, followed by a space. Ex: I
    8·1 answer
  • Which disk drive type contains a magnetic HDD with onboard flash memory serving as a non-volatile cache?
    6·1 answer
  • What combination of words and boolean operators would display all audio files about chiropractic?
    6·1 answer
  • Write an expression that evaluates to true if and only if the value of the integer variable workedOvertime is true.
    7·1 answer
  • It is important that data being imported from a text file into access are separated by a character, such as a comma, which defin
    8·1 answer
  • Given the following business scenario, create a Crow's Foot ERD using a specialization hierarchy if appropriate. Granite Sales C
    12·1 answer
  • How does the speaker feel about traditional forms of poetry
    14·2 answers
  • What type of account provides the same functions as managed service accounts but can be managed across multiple servers as in a
    8·1 answer
  • According to which virtue do you need to secure information by limiting computer access to authorized personnel only?
    6·1 answer
  • A search for reliable information is a search for what?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!