Python program to find the largest of three numbers using nested if else

 

 Python program to find the largest of three numbers using nested if else

Given three numbers , write a program to find the largest among three numbers . 

Sample input

2 5 8

Sample output

8 is largest number

Python program to find the largest of three numbers using nested if else

The objective of the code is to find the largest among three numbers .

Code(Python):-

a,b,c=map(int,input("Enter three numbers \n").split())
if a>b:
if(a>c):
print(f"{a} is the largest number")
else:
print(f"{c} is the largest number")
else:
if(b>c):
print(f"{b} is the largest number")
else:
    print(f"{c} is the largest number")

Output:-

Enter three numbers
2 5 8
8 is the largest number


Recommended Post :-

HCL Coding Questions:-

Capgemini Coding Questions:-

Companies interview:-

Full C course:-    

Key points:-

Cracking the coding interview:-

 Array and string:-

Tree and graph:-

Hackerearth Problems:-

Hackerrank Problems:-

Data structure:-

 MCQs:-


Post a Comment

0 Comments