Write c code to repeatedly ask the user for a number

Assignment Help Computer Engineering
Reference no: EM132194438

Write C code to repeatedly ask the user for a number, then once the user enters 0, the code displays the min, max and average of all values entered.

To get proper credit, name the variables as listed below and follow the directions carefully. Do not use any break or similar type of statements.

To implement the above code, you will need to count the entries - name the counter variable num_count.

You will also need to use a variable, name it min_in so each time the user gives input, and the input is not 0, then compare min_in with the input, if the min_in is > input, then assign min_in to the input.

Similarly name another variable max_in, and compare it to the input, but assign max_in to the input only if max_in is < input.

To calculate the average, accumulate each input into a variable, total. Then after the loop the average is the total divided by the number of entries.

Once the loop is over, display the calculated values (min, max and the average) with a proper wording in three lines. The input is not restricted to integer value so declare the variables above with a proper type. Show the output using two decimal places, and align the three output values as in this sample output:

The minimum entry was: 2.30

The maximum entry was: 62.51

The average of all entries was: 52.81

Reference no: EM132194438

Questions Cloud

Print each element of the array print the sum : Call function sum with the array and size as parameters. Print each element of the array Print the sum .
A string of space-delimited integers from an external file : Write an C code that reads a string of space-delimited integers from an external file ("whatin.txt"), stores them in the stack.
Describe the company culture based on your analysis : Evaluate whether the company's actions seem to align with their vision and mission statements. Describe the company's culture based on your analysis.
What would your investment portfolio look like : Assignment Details: Assume that you were given $100,000 to invest in financial assets. What would your investment portfolio look like?
Write c code to repeatedly ask the user for a number : Write C code to repeatedly ask the user for a number, then once the user enters 0, the code displays the min, max and average of all values entered.
Implications for the development of future leaders : What are the major implications for the development of future leaders as it pertains to crisis leadership?
Describe the facets of crisis management : Describe the facets of Crisis Management and how each facet impacts on the organization.
What is the concept of influence process : What is the concept of influence process? How do you find these concepts and how they are used daily?
How various public health goods and services are delivered : To what extent are various public health goods public or private? Why is it important for you, given your current or future professional role.

Reviews

Write a Review

Computer Engineering Questions & Answers

  What is the purpose of the instruction decoder

What is the purpose of the program counter? What does a sequence controller do?

  Write a program that reads a file containing two columns

Write a program that reads a file containing two columns of floating-point numbers. Prompt the user for the file name. Print the average of each column.

  Discuss the relationships and implementation differences

Discuss the relationships and implementation differences among: reference monitor concept, Trusted Computing Platform Architecture (TCPA), and Microsoft Next Generation Secure Computing Base (formerly known as Palladium project and partly implemen..

  How to run and modify marie program

How to run and modify marie program Include a decision before storing and outputing result. If  value of the result is not positive (so zero or negative), set  Result value to the value ZERO (0)

  You have been tasked with the project of organizing a

you have been tasked with the project of organizing a company offsite 2-day training session in which people are

  Discuss alibaba company it architecture

Discuss it network system. Discuss its security system-vulnerabilities, threats, etc. Describe its e-business or e-commerce. Discuss its mobile technologies.

  Analyze in detail the major risks surrounding byod

Analyze in detail the major risks surrounding BYOD, and analyze the security controls and technologies that are currently available and being utilized to manage these risks.

  Create an application that simulates rolling a pair of dice

Create an application that simulates rolling a pair of dice. When the user clicks a button, the application should generate two random numbers, each in range.

  Does the business problem make sense

Explain the purpose and the action for each method. Remember that methods are typically "verbs" or "actions" related to the problem and its solution.

  What is the output of this code sequence

What is the valid way to declare an integer variable named a?What are the valid ways to declare an integer array name a ?

  Provide at least three various reasons why some health

write a six to eightnbsp page paper in which youprovide at least three various reasons why some health care

  Provide one scenario involving a natural disaster

Provide one scenario involving a natural disaster where your contingency plan would be tested.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd