EasyFoundational
Find the Largest of Three Integers
- Time limit
- 1 s
- Memory limit
- 128 MB
- Estimated
- 15 min
- Programming Fundamentals
Description
Given three integers a, b, and c, return the largest value among them.
The values are not guaranteed to be distinct. If two or all three values are equal and are the maximum, return that shared value. Inputs may be negative, zero, or positive.
Examples:
a = 4, b = 9, c = 2returns9.a = -5, b = -2, c = -8returns-2.a = 7, b = 7, c = 3returns7.
Implement largestOfThree(a, b, c).
Constraints
-1000000000 <= a, b, c <= 1000000000
Sample cases
3Sample 1
Input
a = 4 b = 9 c = 2
Expected output
9
Sample 2
Input
a = -5 b = -2 c = -8
Expected output
-2
Skills and languages
Concepts
- Control Flow and Data Types
Patterns
- Case Analysis
Languages
- Python 3
Solve this problem
Create a free account to write, run and submit your solution.
- Write Python or Java in the browser, with your draft saved as you type
- Run your code on the examples as often as you like
- Submit to a sandboxed judge and see exactly which case failed
- Ask the AI mentor for a hint without being handed the answer