answer.
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]
1 year 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]1 year ago
3 0
It’s not letting me answer it
You might be interested in
Design a BCD-to-Gray code decoder. Your decoder will have 4 inputs: A, B, C and D, representing a 4-bit BCD code (A being the MS
ra1l [238]

Answer:

Binary to Gray Code Converter

The logical circuit which converts the binary code to equivalent gray code is known as binary to gray code converter. An n-bit gray code can be obtained by reflecting an n-1 bit code about an axis after 2n-1 rows and putting the MSB (Most Significant Bit) of 0 above the axis and the MSB of 1 below the axis.

The 4 bit binary to gray code conversion table is given in attached file.

3 0
1 year ago
Read 2 more answers
A major clothing retailer has requested help enhancing their online customer experience. How can Accenture apply Artificial Inte
Harrizon [31]

Answer:

Option D

Explanation:

Artificial intelligence is a technology where the information gathered in the past is processed for the future actions.

Here, based on the preferences of customer in the past and purchase history, AI can suggest the customer new products and services

Hence, option D is correct

3 0
1 year ago
1. Accessing calendars, contact information, emails, files and folders, instant messages, presentation, and task lists over the
Veseljchak [2.6K]
1. Cloud Computing
2. Web Conferencing
3. Ribbon
4. PowerPoint
5. Sadie should share the document in One Drive and give her sister permission to edit the document
6. The design and arrangement of items for efficiency and safety
6 0
2 years ago
Which statement correctly describes an adaptive score?
d1i1m1o1n [39]

B. An adaptive score changes in response to player actions in the game.

it <em>could</em> be D. if the context was in a musical score...like an orchestra...I think that's just there to be funny

5 0
2 years ago
Read 2 more answers
When a file is transferred between two computers, two acknowledgment strategies are possible. in the first one, the file is chop
ra1l [238]
The TCP/IP stack is responsible for the "chopping up" into packets of the data for transmission and for their acknowledgment. Depending on the transport protocol that is used (TCP or UDP) each packet will be <span>acknowledged or not, respectively.
</span><span>the strategy when the file is chopped up into packets, which are individually acknowledged by the receiver, but the file transfer as a whole is not acknowledged is OK in situations (Applications) that do not need the whole file to be sent, Web site for example: different parts of the web site can arrive in different times.

The other strategy, in which </span><span>the packets are not acknowledged individually, but the entire file is acknowledged when it arrives is suitable for FTP (mail transfer), we need whole mail, not parts of it. </span>
5 0
2 years ago
Other questions:
  • What is one effective way for employees to keep their skillsets current?
    8·2 answers
  • Email, instant messaging and most web traffic go across the internet in the clear; that is, anyone who can capture that informat
    15·2 answers
  • When you examine a computer chip under a microscope, what will you see?
    6·1 answer
  • When a typeface does not have any extra embellishments on the top and bottom of the letterforms, it is called a ________ font?
    12·1 answer
  • Mechanical advantage is the ratio of the force required to move a load divided by______
    12·1 answer
  • "Suppose there is a class Alarm. Alarm has two class variables, code which contains a String value representing the code that de
    10·1 answer
  • In the game of $Mindmaster$, secret codes are created by placing pegs of any of seven different colors into four slots. Colors m
    5·1 answer
  • What is an input to the Program Increment Planning process that highlights how Product Management plans to accomplish the Vision
    15·1 answer
  • 4. Why does Hancock believe that our communication online is more honest than we might<br> expect?
    15·2 answers
  • 3. Write a program to find the area of a triangle using functions. a. Write a function getData() for user to input the length an
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!