Write a Python Program to find Largest of Two Numbers

Python Program to find Largest of Two Numbers

In This Program, Write a Python Program to find Largest of Two Numbers With source code and example.

Python Program to find Largest of Two Numbers

In This program There are many approaches to find the largest of two number, in this python program we discuss a few of them. Then the python program user enter the two different values . next the python program finds the largest number among those two number using Elif statements.

 

# Python Program to find Largest of Two Numbers

a = float(input(" Please Enter the First Value a: "))
b = float(input(" Please Enter the Second Value b: "))

if(a > b):
    print("{0} is Greater than {1}".format(a, b))
elif(b > a):
    print("{0} is Greater than {1}".format(b, a))
else:
    print("Both a and b are Equal")

 
In this Program to find Largest of Two Numbers output, First, we entered the values a = 50, b = 100

 Please Enter the First Value a: 50
 Please Enter the Second Value b: 100
100.0 is Greater than 50.0

Next, we entered the values a = 50, and b = 50

 Please Enter the First Value a: 50
 Please Enter the Second Value b: 50
Both a and b are Equal

Leave a Comment

Verified by MonsterInsights