Find the Greatest of Two Numbers in Python
Login/Signup to comment
4 comments on “Find the Greatest of Two Numbers in Python”
×
30+ Companies are Hiring
Get Hiring Updates right in your inbox from PrepInsta
Login/Signup to comment
Get Hiring Updates right in your inbox from PrepInsta
N1 = int(input(“Enter the first number : “))
N2 = int(input(“Enter the second number : “))
diff = N1 – N2
if diff 0:
print(f”{N1} is greater”)
elif diff == 0:
print(“Both the numbers are same”)
not included the equality condition
n1 = int(input(“Enter the number 1 : “))
n2 = int(input(“Enter the number 2 : “))
if n1 < n2:
print(f"{n2} is Grater")
# elif n1 == n2:
# print(f"{n1} and {n2} are equal")
else:
print(f"{n1} is grater ")
a=int(input(“Enter the First number: “))
b=int(input(“Enter the Last number: “))
if(a>b):
print(“The greatest number is “,a)
elif(b>a):
print(“The greatest number is “,b)
else:
print(“The numbers are equal”)
In this program there is no case for when numbers are equal here the program for that case too.