-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathloops questions.py
More file actions
54 lines (41 loc) · 1.13 KB
/
loops questions.py
File metadata and controls
54 lines (41 loc) · 1.13 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# Given three integers a,b,c find maximum of three and print it
a = int(input("Enter the value"))
b = int(input("Enter the value"))
c = int(input("Enter the value"))
# if(a>b):
# if(a>c):
# print(f"{a} is the max")
# elif(b>a):
# if(b>c):
# print(f"{b} is the max value")
# elif(c>a):
# if(c>b):
# print(f"{c} is the max value")
# elif(a==b==c):
# print(f"{a} is the max value")
if(a>=b and a>=c):
print(f"{a} is the max")
elif(b>=a and b>=c):
print(f"{b} is the max")
else:
print(f"{c} is the max ")
print(max(a,b,c))
#Given 4 integers a,b,c,d find max of these 4.
a = int(input("Enter the value "))
b = int(input("Enter the value "))
c = int(input("Enter the value "))
d = int(input("Enter the value "))
if(a>=b and a>=c and a>=d):
print(f"{a} is the max ")
elif(b>=a and b>=c and b>=d):
print(f"{b} is the max ")
elif(c>=a and c>=b and c>=d):
print(f"{c} is the max ")
else:
print(f"{d} is the max ")
# Leap year or not
leap = int(input("Enter the year"))
if(leap%400==0 or (leap%4==0 and leap%100 != 0)):
print("Leap year")
else:
print("Not leap year")