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
Prepare a algorithm visualization for the Tower of Hanoi when 4 disks are to be moved from spindle #1 to spindle #3.
Setler [38]

Answer:

follwing is the code for Tower of Hanoi for n disks.

#include <iostream>

using namespace std;

void towofhan(int n,char source,char aux,char dest)//function for tower of hanoi..

{

if(n<0)

return ;

   if(n==1)//base case.

   {

       cout<<"Move disk 1 from "<<source<<" to spindle "<<dest<<endl;

       return;

   }

   towofhan(n-1,source,dest,aux);//recursive call.

   cout<<"move disk "<<n<<" from "<<source<<" to spindle "<<dest<<endl;

   towofhan(n-1,aux,source,dest);//recursive call.

}

int main() {

   int n=4;

   towofhan(n,'1','2','3');//function call.

   return 0;

}

Explanation:

If there is only 1 disk then we have to move the disk from source to destination.

Then after that we will apply recursion to solve the problem.

We have to work on only nth disk else will be done by the recursion.

First call recursion to move n-1 disks from source to auxiliary.

Then move nth disk from source to destination spindle.

Now move n-1 disks that are on the auxiliary spindle to destination spindle.

6 0
3 years ago
What skills used in video game play could be useful in scientific problem-solving games such as Foldit?
Sidana [21]
For the answer to the question above asking w<span>hat skills used in video game play could be useful in scientific problem-solving games such as Foldit?
Playing that game, it involves "critical thinking and puzzle solving skills. You need to solve </span><span>a protein-folding game like </span><span>unlock the structure of an AIDS-related enzyme.</span>
6 0
3 years ago
50 POINTS! What is wrong with this python code? The syntax error is on the first line.
nexus9112 [7]

Answer:

This isnt pyton code

Explanation:

7 0
3 years ago
What subnet mask can be used to segment the 172.16.0.0 network to allow for a minimum of 6 subnets while maximizing the number o
marishachu [46]

The subnet mask can be utilized to segment the 172.16.0.0 network to qualify for a minimum of 6 subnets while maximizing the numeral of broadcasters per subnet is 255.255.224.0

<h3>What do subnet masks mean?</h3>
  • A subnet mask is a 32-bit numeral formed by setting keeper bits to all 0s and developing network times to all 1s.
  • In this way, the subnet mask divides the IP speech into the network and host addresses.
  • A subnet mask is used to separate an IP address into two pieces. One element defines the host (computer), and the different part identifies the network to which it belongs.
  • To better comprehend how IP lessons and subnet masks work, look at an IP speech and see how it's managed.

To learn more about  subnet mask, refer to:

brainly.com/question/3234986

#SPJ4

5 0
2 years ago
How does tracking changes relate to sharing a workbook in Excel?
ElenaW [278]

Answer:When you highlight changes as you work, Excel outlines any revisions (such as changes, insertions, and deletions) with a highlighting color. On the Review tab, click Track Changes, and then click Highlight Changes. Select the Track changes while editing. This also shares your workbook check box.

Explanation:

8 0
3 years ago
Other questions:
  • A Hierarchy Custom Setting stores a specific URL for each profile in Salesforce. Which statement can a developer use to retrieve
    5·1 answer
  • Security testing attempts to verify that protection mechanisms built into a system protect it from improper penetration.
    9·1 answer
  • April plans on starting a perfume business and decides she needs to first
    15·1 answer
  • A beginning driver may tend to oversteer. This means the driver what? Btw Cars are technology so that is why it is under Compute
    11·1 answer
  • In the Dread Pirate Roberts case, U.S. Ulbricht, 31 F. Supp. 3D 54D (S.D.N.Y. 2014), one of the issues that the court addressed
    10·1 answer
  • For this exercise, you are given a phrase. Return the number of time the word “dog” appears in the phrase.
    7·1 answer
  • Which of the following would be considered the highest risk portfolio?
    9·1 answer
  • Need answer ASAP!!!!
    7·1 answer
  • You are not sure if a certain word has an"e"at the end<br>​
    11·1 answer
  • When using a small mic that attaches to your interview subject, where should you place that mic and why?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!