- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

# Python program to find the maximum of three numbers

In this tutorial, we are going to write a program which finds the max amount from the three figures. We will have three number, and our goal is to find out the maximum number from those three numbers.

Let's see some sample test cases for better understanding.

Input: a, b, c = 2, 34, 4 Output: 34

Input: a, b, c = 25, 3, 12 Output: 25

Input: a, b, c = 5, 5, 5 Output: 5

Follow the below steps to find out the max number among three numbers.

## Algorithm

1. Initialise three numbers a, b, c. 2. If a is higher than b and c then, print a. 3. Else if b is greater than c and a then, print b. 4. Else if c is greater than a and b then, print c. 5. Else print any number.

Let's see the code for the above algorithm.

## Example

## initializing three numbers a, b, c = 2, 34, 4 ## writing conditions to find out max number ## condition for a if a > b and a > c: ## printing a print(f"Maximum is {a}") ## condition for b elif b > c and b > a: ## printing b print(f"Maximum is {b}") ## condition for c elif c > a and c > b: ## printing print(f"Maximum is {c}") ## equality case else: ## printing any number among three print(a)

## Output

If you run the above program, you will get the following output.

Maximum is 34

Let's execute the code once again for different test case

## Example

## initializing three numbers a, b, c = 5, 5, 5 ## writing conditions to find out max number ## condition for a if a > b and a > c: ## printing a print(f"Maximum is {a}") ## condition for b elif b > c and b > a: ## printing b print(f"Maximum is {b}") ## condition for c elif c > a and c > b: ## printing print(f"Maximum is {c}") ## equality case else: ## printing any number among three print(f"Maximum is {a}")

## Output

If you run the above program, you will get the following output.

Maximum is 5

## Conclusion

If you have any doubts regarding the tutorial, mention them in the comment section.

- Related Questions & Answers
- C# program to find the maximum of three numbers
- Java program to find maximum of three numbers
- Python program maximum of three.
- Program to find largest of three numbers - JavaScript
- Program to find maximum sum of multiplied numbers in Python
- Java Program to Find the Largest Among Three Numbers
- Program to find the common ratio of three numbers in C++
- Maximum Product of Three Numbers in C++
- Java program to find smallest of the three numbers using ternary operators
- Java program to find largest of the three numbers using ternary operators
- C program to Find the Largest Number Among Three Numbers
- How to Find the Largest Among Three Numbers using Python?
- C++ Program to Find Largest Number Among Three Numbers
- Java Program to get the maximum of three long values
- Find the greatest product of three numbers in JavaScript

Advertisements