-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathminmax.py
More file actions
32 lines (24 loc) · 788 Bytes
/
minmax.py
File metadata and controls
32 lines (24 loc) · 788 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#program to print max and min of 'n' numbers without using any data structure
print("*****MENU*****")
print("1: finding minimum of 'n' numbers")
print("2: finding maximum of 'n' numbers")
choice=int(input("enter your choice here>>>"))
print("***************")
if choice==2:
n=int(input("Enter number of elements: "))
print("enter numbers: ")
maxNo=int(input(""))
for i in range(1,n):
num1=int(input())
if num1>maxNo:
maxNo=num1
print("The max number is : ",maxNo)
elif choice==1:
n=int(input("Enter number of elements :"))
print("Enter numbers :")
minNo=int(input())
for i in range(1,n):
num1=int(input())
if num1<minNo:
minNo=num1
print("The min number is : ",minNo)