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
AP CSP - Write a program that takes 10 random numbers from 1 to 12 inclusively and averages them together.
Amanda [17]

Answer:

follows are the correct python code to this question:

import random as r#import random package as r

import statistics as s #import statistics package as s

l= r.sample(range(0,12),10)#defining l variable that use random function to store 10 random numbers

avg= s.mean(l)#defining avg variable for calculate average of l

print('List of random number are: ', l)#print list of random numbers

print("The random number Average is: ", avg)#print average value

Output:

List of random number are:  [4, 10, 6, 0, 3, 5, 1, 7, 11, 2]

The random number Average is:   4.9

Explanation:

In question 1:

In the given code, two packages are imported, which are "random and statistics", in which "random" is used to generate a random number, and "statistics" is used to calculate the average value.

In the code, the "l" variable is used, which uses a random function and store 10 random numbers, and an "avg" variable is defined that calculates the average value. In the last step, the print method is used that print number and its average value.

In question 2:

The given code is wrong because it only calls the "random" method, which is not defined.

3 0
3 years ago
Every brand of computer has its own binary language, called
Kaylis [27]
Machine language.

Hope this helps
6 0
3 years ago
Which of the following are characteristics of a cell
olganol [36]

Answer:

-occurs at the intersection of columns and  rows

-is a single unit for entering data on a  spreadsheet

-is located according to its cell reference or  cell address

Explanation:

A cell is a box in a spreadsheet program that contains information and each cell is identified using a cell reference that indicates the colum letter followed by the row number where the cell is located. So, according to this, the characteristics of a cell in a spreadsheet software are:

-occurs at the intersection of columns and  rows

-is a single unit for entering data on a  spreadsheet

-is located according to its cell reference or  cell address

5 0
3 years ago
when an overridden method is called from within a subclass, it will always refer to the version of that method defined by the (a
bija089 [108]

Option b is correct. When an overridden method is called from within a subclass, it will always refer to the version of that method defined by the subclass.

Subclasses are classes that can be created by adding new functionality to a parent class, such as new object variables or new methods. In terms of automata theory, a subclass expands the state transition table with new rows and states. However, by overriding (changing) existing functionality, the majority of OO programming languages also enable us to derive subclasses from parent classes. When implementing a class, all that is required to be specified is the new or updated functionality thanks to inheritance mechanisms between parent class and subclass.

Lines connected through a circle connect the subclasses HourlyEmployee and SalaryEmployee to the superclass Employee. The circled letter "d" stands for disjointness, which demands that the specification's subclasses be distinct. As a result, an entity can belong to only one of the specification's subclasses. An individual employee can only be paid either hourly wages or a salary; they cannot be paid both. The open sides of the inheritance (arch) symbols face the superclass.

To know more about subclass click on the link:

brainly.com/question/13790787

#SPJ4

6 0
1 year ago
Choose the true statement below. Question 8 options: A) The content that displays in the browser is contained in the head sectio
Rzqust [24]

Answer:

a. The content that displays in the browser is contained in the head section.

5 0
3 years ago
Other questions:
  • Which statement describes the word "iterative"?
    7·2 answers
  • What is the difference between a learner’s license and an operator’s license?
    13·1 answer
  • Answer all 1).The most common layout of keys on the keyboard is the _____ keyboard. ASDF QWERTY JKL QWOPY,
    5·2 answers
  • 4. Extrusion tools in Blender® duplicate vertices while keeping the geometry connected with the original vertices. (1 point)
    7·1 answer
  • The internet connects millions of computers connected through millions of ____ worldwide.
    9·1 answer
  • Why Stockholder are interested in the way a company operate?
    12·1 answer
  • PMI is a: computer program used to help managers write mission statements. rule of thumb used to determine how many employees sh
    15·1 answer
  • What 2 important components are found on a motherboard? (2 points each)
    13·1 answer
  • The scope of a temporary table is limited to what?
    10·1 answer
  • You have recently compiled a custom Linux kernel. You notice some performance issues with and need to use the kernel log files t
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!