Home »
Python programs
Python | Find largest of three number using nested if else
Python | Nested if else example: Here, we are implement a program, it will input three numbers and find the largest of three numbers.
Submitted by Pankaj Singh, on October 04, 2018
Input three integer numbers and find the largest of them using nested if else in python.
Example:
Input:
Enter first number: 10
Enter second number: 20
Enter third number: 5
Output:
Largest number: 20
Program:
# input three integer numbers
a=int(input("Enter A: "))
b=int(input("Enter B: "))
c=int(input("Enter C: "))
# conditions to find largest
if a>b:
if a>c:
g=a
else:
g=c
else:
if b>c:
g=b
else:
g=c
# print the largest number
print("Greater = ",g)
Output
Enter A: 10
Enter B: 20
Enter C: 5
Greater = 20
TOP Interview Coding Problems/Challenges