subject

Write a program to read-in a sequence of integers from the keyboard using scanf(). Your program will determine (a) the largest integer 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

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 10:00
Which is a false statement considering copyright law? a. when people upload something to the internet they automatically receive a copyright for the work b. the work does not have to contain a copyright notice to be considered having a copyright c. copyright is legal term describing rights given to the creators for literary and artistic works d. personal pictures are always covered by copyrights
Answers: 1
question
Computers and Technology, 22.06.2019 11:00
The editing of digital photos us about the same level of difficulty as editing an analog photo
Answers: 2
question
Computers and Technology, 22.06.2019 13:00
Write a program which asks you to enter a name in the form of first middle initial last. so you might enter for example samuel p. clemens. use getline to read in the string because it contains spaces. also, apparently the shift key on your keyboard doesn’t work, because you enter it all lower case. pass the string to a function which uses .find to locate the letters which need to be upper case and use toupper to convert those characters to uppercase. the revised string should then be returned to main in the form last, first mi where it will be displayed.
Answers: 1
question
Computers and Technology, 24.06.2019 02:10
Consider the usual algorithm to convert an infix expression to a postfix expression. suppose that you have read 10 input characters during a conversion and that the stack now contains these symbols: (5 points) | | | + | | ( | bottom |_*_| now, suppose that you read and process the 11th symbol of the input. draw the stack for the case where the 11th symbol is
Answers: 2
You know the right answer?
Write a program to read-in a sequence of integers from the keyboard using scanf(). Your program will...
Questions
question
Mathematics, 28.01.2021 21:00
question
Mathematics, 28.01.2021 21:00
question
Mathematics, 28.01.2021 21:00
question
Computers and Technology, 28.01.2021 21:00
question
Mathematics, 28.01.2021 21:00
Questions on the website: 13722367