Write a short segment of code that will ask the user for 100 integers. (use a for loop) After all integers have been read, your code should then display the largest integer, the smallest integer and the average of the integers entered from the keyboard. Python language

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter5: Repetition Statements
Section: Chapter Questions
Problem 9PP
icon
Related questions
Question
  • Write a short segment of code that will ask the user for 100 integers. (use a for loop) After all integers have been read, your code should then display the largest integer, the smallest integer and the average of the integers entered from the keyboard. Python language 
Expert Solution
Algorithm

Step 1: Prompt and accept 100 integers from the user.

Step 2: Append the integers to the list.

Step 3: Find the smallest element by invoking the min() function and display it on the output screen.

Step 4: Find the largest element by invoking the max() function and display it on the output screen.

Step 5: Define the average() function which accepts the list of integers. It determines the sum of elements of the list and divides it by the length of the list to compute the average.

Step 6: Invoke the average() function and display the value returned on the screen.

trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Types of Loop
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning