PWP-PR-4
PWP-PR-4
#Enrollment: 2205690362
#Batch: 2
Code:
#find the largest no among 3 numbers
n1 = int(input("Enter the first no: "))
n2 = int(input("Enter the first no: "))
n3 = int(input("Enter the first no: "))
Output:
Enter the first no: 5
Enter the first no: 4
Enter the first no: 3
5 is greater among three
Code:
#find the largest no among 3 numbers
n1 = int(input("Enter the first no: "))
n2 = int(input("Enter the first no: "))
n3 = int(input("Enter the first no: "))
Output:
Enter the first no: 2
Enter the first no: 3
Enter the first no: 4
4 is greater among three
Code:
# find if the input year is a leap year
year = int(input("Enter a year: "));
if year % 4 == 0:
print(year, " is a leap year")
else:
print(year, " is not a leap year")
Output:
Enter a year: 2024
2024 is a leap year
Code:
if n > 0:
print(n, " is positive")
elif n < 0:
print(n, " is negative")
else:
print("No is zero")
Output:
Enter a number: 5
5 is positive
Enter a number: 0
No is zero
Code:
m1 = int(input("First: "))
m2 = int(input("Second: "))
m3 = int(input("Third: "))
m4 = int(input("Fourth: "))
m5 = int(input("Five: "))