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
leva
13 days 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:
8_murik_8 [964]13 days ago
3 0
It's not allowing me to respond.
You might be interested in
Here is a super challenge for you if you feel up for it. (You will need to work this out in Excel.) In 2017 the Islamic month of
8_murik_8 [964]

Response:

7/73

Clarification:

May consists of 31 days. By calculating 31 - 26, we find 5 days remaining until June. Therefore, Muslims fasted for a total of 35 days. In 2017, there were 365 days, leading to 365 - 35 = 330 days without fasting. Consequently, the fraction representing the fasting period is 35/365, which simplifies to 7/73.

4 0
1 month ago
Tanya wants to include a video with all its controls on her web page. The dimensions of the video are as follows:
Natasha_Volkova [1026]
I believe the correct answer is formats
4 0
1 month ago
Read 2 more answers
Write a function so that the main program below can be replaced by the simpler code that calls function mph_and_minutes_to_miles
Natasha_Volkova [1026]

Answer:

def mph_and_minutes_to_miles(hours_traveled, miles_traveled):

   hours_traveled = minutes_traveled / 60

   miles_traveled = hours_traveled * miles_per_hour

   print('Miles: %f' % miles_traveled)

Explanation:

This function, written in Python, specifies two input parameters (hours_traveled, miles_traveled)

When executed, the main function prompts the user for necessary data, calls this method, and passes the inputs as arguments. Refer to the complete code and output that follows.

6 0
1 month ago
What happened if the offshore team members are not able to participate in the iterations demo due to timezone/infrastructure iss
zubka84 [1067]

What if the offshore team members are unable to join the iterations demonstration because of timezone or infrastructure issues? (c) Not a significant problem. The offshore lead and the onsite team members will attend the demo with the product owner and can relay the feedback to the offshore team afterwards.

Explanation:

Not a significant problem. The offshore lead and the onsite team members will attend the demo with the product owner and can relay the feedback to the offshore team afterwards.

From the previous statement, it is evident that if offshore team members cannot attend the demo alongside the product owner due to issues with time zones or infrastructure, it won't pose a major concern because the onsite team will be present and can share all relevant insights and feedback with the offshore team. They all belong to the same team.

Therefore, the answer (3) is correct

4 0
2 months ago
The processing of data in a computer involves the interplay between its various hardware components.
Amiraneli [1052]

Affirmative.

Data processing entails transforming raw data and managing its flow through the Central Processing Unit and Memory to output devices. A computer's CPU contains two main parts: the Arithmetic Logic Unit (ALU) and the control unit. The ALU handles complex calculations and logical operations, while the control unit retrieves, decodes instructions, and regulates the data exchange between Memory, ALU, primary and secondary storage, along with various output devices.


8 0
17 days ago
Other questions:
  • Accenture is helping a large retailer transform their online sales and services. The Data Analyst audits the client’s customer j
    12·1 answer
  • Write a loop that prints each country's population in country_pop. Sample output for the given program.
    6·1 answer
  • RADIAC instruments that operate on the ionization principle are broken down into three main categories based on what?
    15·1 answer
  • Write a program that prompts the user to enter three cities and displays them in ascending order. Here is a sample run: Enter th
    8·1 answer
  • Write a program in pascal to find the area of a circle
    14·1 answer
  • The Online Shopping system facilitates the customer to view the products, inquire about the product details, and product availab
    8·1 answer
  • The piston engine uses the ________ to convert the reciprocating motion of the piston into rotary motion.
    13·1 answer
  • _______________ is used by a hacker to mask intrusion and obtain administrator permissions to a computer.
    7·1 answer
  • Write a function named firstLast2 that takes as input an array of integers and an integer that specifies how many entries are in
    14·1 answer
  • A bicycle sharing company is developing a multi-tier architecture to track the location of its bicycles during peak operating ho
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!