Take three numbers as arguments and returns the largest of them

Contents

Take three numbers as arguments and returns the largest of them.

A function max_of_three() that takes three numbers as arguments and returns the largest of them.

Users can enter any three numbers from the key-board and then we can find that among that three numbers which is the greatest number. If you want to find the least number then also you can find it.

Algorithm: To find the largest number with 3 numbers

• Step1. start
• Step2. define max function
• Step3. In max function read a, b, c
• Step4. check the condition a>b and a>c
• Step5.If the condition is true return a
• Step6. Otherwise check the condition b>c
• Step7. If the condition is true return b Otherwise return c
• Step8. declare the variables a,b,c, and read them.
• Step9. Print the largest of three numbers.
• Step10. End   Program:

Source Code: Python Program to Find the Largest Among Three Numbers

`def max(a,b,c):    if (a>b and a>c):        return a    elif(b>c):        return b    else:        return ca=int(input('enter a:'))b=int(input('enter b:'))c=int(input('enter c:'))ans=max(a,b,c)print('largest of three numbers=', ans)`

Output:

enter a:23
enter b:33
enter c:23
largest of three numbers= 33