Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Can you please help me out with ctr-z, i tried but it couldt get it to work thank alot TUI II III Is Plugi all
Can you please help me out with ctr-z, i tried but it couldt get it to work
thank alot
TUI II III Is Plugi all 1 C DICKDOU COUSC WU Dy the uut ull. 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)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started