Find the Maximum of Three Numbers

0
Rishi Agnihotri
Rishi Agnihotri
Aug 11, 2026 10:15 PM 0 Answers Python
Member Since Aug 2026
Subscribed Subscribe Not subscribe
Flag(0)

Write a Python function find_max(a, b, c) that takes three numbers as input and returns the largest among them without using the built-in max() function.

Input: Three numbers a, b, c.
Output: The largest of the three numbers.
Constraints: Numbers can be integers or floats.
Example: find_max(10, 25, 15) -> 25

Explanation: Compare a, b, and c using conditional if-elif-else statements.
Complexity: Time: O(1), Space: O(1)

1 Subscribers
Rishi Agnihotri

Select Programming Language

Submit Answer
0 Answers
Sort By:

Python
def find_max(a, b, c):
    if a >= b and a >= c:
        return a
    elif b >= a and b >= c:
        return b
    else:
        return c

# Example usage
print(find_max(10, 25, 15))
0
🎬 YoKod Reel
Your Text
🎵 Add Music
Aa Add Text
🖼 Add Overlay
✨ Filters
🎚 Edit
⛶ Video Ratio
⏱ Reel Timer
</> Programming Code
Select one or multiple languages
HTML
CSS
JavaScript
TypeScript
PHP
Python
Java
C
C++
C#
SQL
React
JSON
XML
Bash
Kotlin
Swift
Dart
Your programming code is saved separately from the video so visitors can open the Reel and view the code.
Add Music
🎵
the_mountain-phonk-phonk-music-496450 (1)
Original Audio