# Maximum out of three number in python by R4R Team

Example -

let we have a two number
a=34
b=56
c=23
so we can easily judge that 56 is maximum in all of them

Program to find out the maximum number out of three-

a=int(input("Enter first numbern"))
b=int(input("Enter second numbern"))
c=int(input("Enter third numbern"))

#first way
if a>b and a>c:
print(str(a)+" is maximum")
elif b>c:
print(str(b)+" is maximum")
else:
print(str(c)+" is maximum")

#second way
print(str(max(a,b,c))+" is maximum")

output-

Enter first number
23
Enter second number
34
Enter third number
56
56 is maximum
56 is maximum

program to do this in a single line -

print(str(max(list(map(int,input("Enter number in listn").split()))))+" is maximum")

output -

Enter three value
45 23 34
45 is maximum

In this program, we done this in one line and that's the beauty of the python programming language. How it works ? Firstly we take string input then with the use of split() we seprate the number then using map we type cast the string number to integer number then list is created then max() function is find the maximum out of them and print() function display that.

##### R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!