Computer Science, asked by alenantony608, 4 months ago

WAP to calculate maximum and minimum element of a given list of numbers​

Answers

Answered by anindyaadhikari13
2

Required Answer:-

Question:

  • Write a program to calculate maximum and minimum element of a given list of numbers.

Solution:

Here is the program. This is written in Python.

n=int(input("How many elements???  "))

l=[]

print("Enter them...")

for i in range(n):

l.append(int(input("Enter:  ")))

print("Largest Element:  ",max(l))

print("Smallest Element:  ",min(l))

Explanation:

  • The max() and min() function of Python is used to find out the maximum and minimum of a given list of numbers. Using this functions, the question is solved.

Refer to the attachment for output ☑.

Attachments:
Answered by Oreki
1

Program

   numbers = [int(number) for number in input("Enter the numbers - ").split( )]

   print(f" Max - {max(numbers)}\n Min - {min(numbers)}")

Algorithm

  • Accepting the numbers.
  • Finding and displaying the minimum and maximum elements.
Attachments:
Similar questions