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
Anna007 [38]
3 years ago
8

Write a program to read-in a sequence of integers from the keyboard using scanf(). Your program will determine (a) the largest i

nteger entered, (b) the smallest integer entered, and (c) the average of the integers entered, and print these values to the screen.
1) Your program will begin by notifying the user to input an integer sequence from the keyboard, one-at-a-time, and to hit the Enter key after typing each integer. Notify the user to hit Ctrl-z (EOF) when they are done entering integers.
2) Your program should declare an integer variable to hold the largest entered integer, an integer variable to hold the smallest integer entered, a float variable to hold the sum of the entered integers and an integer variable to count how many integers are entered by the user. Initial iret to +1 and initialize the other three variables to zero.
3) Your program should use a while loop to continue reading integers from the keyboard until the user is done.
4) The user is done when they enter Ctrl-z from the keyboard. How can your program determine when the user has entered Ctrl-z? Consider the following program segment. int ienter=0,iret=0; iret=scanf("%d",ienter); When the user enters an integer from the keyboard, scanf(will return +1 (success), indicating that it correctly read-in an integer. The integer entered by the user is stored in variable ienter and the return value from scanf() is captured and stored in variable iret.
When the user enters Ctrl-z (EOF), scanf(will return-1 (EOF) indicating an integer from the keyboard was not correctly read-in. That is, if the user enters Ctrl-z (EOF), no value is stored in variable ienter and the - 1 returned by scanf() is captured and stored in variable iret. So to test when the user is done entering integers, the while loop should continue looping (reading integers from the keyboard) as long as iret is equal to +1.
ienter=0;
iret=scanf("%d",&ienter);
ilargest=ienter;
whileiret == 1){
ireto=scanf("%d",&ienter); // read another integer from the keyboard
5) When the user enters the very 1 integer, your program will initialize the variables for the largest and smallest integers and the variable for the sum to this 1 integer entered by the user. Why? If no more integers are entered by the user, these variables will hold the correct values. The variable for the number of integers entered by the user should be incremented by 1 whenever an integer is entered by the user.
6) After the user has entered Ctrl-z, meaning the user is done, the variable for the average should be computed as the sum of the entered integers divided by the number of integers entered by the user.
7) Your program will display the largest and smallest entered integers, the number of integers entered by the user, and the average of the integers.
Get more help from Chegg
Computers and Technology
1 answer:
Natali [406]3 years ago
3 0
It’s not letting me answer it
You might be interested in
When an architect designs a building, what visual design elements could be used to help capture a viewer’s attention? A) The use
Salsk061 [2.6K]
The correct answer is A
6 0
3 years ago
Read 2 more answers
What is the FaFASA4caster used for
pav-90 [236]

Answer:

The FAFSA4caster is a free financial aid tool from the federal government that allows you to practice filling out the Free Application for Federal Student Aid (FAFSA) and estimate the financial aid you could receive based on student and family assets and income.

6 0
3 years ago
In a study on software license infringement, those from United States were significantly more permissive than those from the Net
daser333 [38]

Answer:

The answer is "False"

Explanation:

In the given statement some information is missing, that is options "true or false", which can be described as follows:

The software suite breach has become a lawful effort, that arises as just a consequence of piracy, in which the court charges resulting as a condition of piracy is the patent license violation charge. Its use, replication or sharing of proprietary technology is not allowed as online piracy.

  • It enables firms to provide their operating systems more effectively.  
  • In this the US was rather more strict, than the Netherlands and other countries, that's why the given statement is false.
8 0
3 years ago
Find the median and mean of the data set below: 29 17 40 12 29
quester [9]

answer:

median: 29

arrange the data in ascending order, and the median is the value in the middle. If there are an even number of values, the median would be the product of the two middle numbers. (12, 17, 29, 29, 40)

mean: 25.4

the mean of a set of numbers is the sum divided by the number of terms.

12 + 17 + 29 + 29 + 40 = 127 / 5 = 25.4

hope this helped!

6 0
3 years ago
Quick time and flash are two examples of what product
zheka24 [161]

there apps .........

8 0
3 years ago
Other questions:
  • Write a program that calculates an adult's fat-burning heart rate, which is 70% of 220 minus the person's age. Complete fat_burn
    10·1 answer
  • The term composite would be used to describe an image that was altered by the Crop tool.
    15·1 answer
  • In doing a load of clothes, a clothes drier uses 18 A of current at 240 V for 59 min. A personal computer, in contrast, uses 3.0
    7·1 answer
  • Ooooooooooooooooooooooooooooh im blinded by the lightssssssssss
    11·1 answer
  • Mercury Technical Solutions has been using SSL in a business-to-business environment for a number of years. Despite the fact tha
    5·1 answer
  • When entering a expressway using a weave lane you must do what
    7·1 answer
  • Please help
    11·1 answer
  • When locating and correcting accessibility issues for a document, you would click what first?
    11·1 answer
  • Ethan is coding in Python and trying to add a set of numbers including both floats and integers. What should he do to make sure
    12·1 answer
  • 1. If an android phone is out of date or outdated and it requires an update. Explain the steps how I can update this phone.
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!