Input three numbers and display the largest/smallest number Python Program
# Python Program to input 3 numbers and display the largest number
#input first,Second and third number
num1=int(input("Enter First Number"))
num2=int(input("Enter Second Number"))
num3=int(input("Enter Third Number"))
#Check if first number is greater than rest of the two numbers.
if (num1> num2 and num1> num3):
print("The Largest number is", num1)
#Check if Second number is greater than rest of the two numbers.
elif (num2 > num1 and num2> num3):
print ("The Largest number is", num2)
else:
print ("The Largest number is", num3)
Output:
Enter First Number8 Enter Second Number6 Enter Third Number5 The Largest number is 8 >>>
# Python Program to input 3 numbers and display the smallest number
#input first,Second and third number
num1=int(input("Enter First Number"))
num2=int(input("Enter Second Number"))
num3=int(input("Enter Third Number"))
#Check if first number is lesser than rest of the two numbers.
if (num1< num2 and num1< num3):
print("The Smallest number is", num1)
#Check if Second number is greater than rest of the two numbers.
elif (num2 < num1 and num2< num3):
print ("The Smallest number is", num2)
else:
print ("The Smallest number is", num3)
Output:
Enter First Number4 Enter Second Number5 Enter Third Number6 The Smallest number is 4 >>>