Python Program to find largest number of 2 numbers
In this example shows, how to find the largest of two given numbers.
Steps
- Takes two numbers as input from the user
- Using if-else to determine which one is the largest.
- Display the output whichever is the larger of the two given numbers.
Here is an example Python program to find the largest of 2 numbers.
Example.py
a=int(input("Enter the First number : ")) b=int(input("Enter the Second number : ")) lrg=int() if b>a: lrg=b else: lrg=a print("The largest number is ", lrg)
Output 1
Enter the First number : 85 Enter the Second number : 47 The largest number is 85
Output 2
Enter the First number : 58 Enter the Second number: 92 The largest number is 92