Python: Nested if-else example: Here, we are executing a program, it will enter three numbers and locate the biggest of three numbers.
Information three whole number numbers and locate the biggest of them utilizing settled 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