Max of Three Numbers
Python
Easy
4 views
Problem Description
Read three integers a, b, c. Output the maximum using if-else logic.
Input Format
One line: a b c.
Output Format
One integer max.
Official Solution
import sys
p=sys.stdin.read().strip().split()
if not p: sys.exit(0)
a=int(p[0]); b=int(p[1]); c=int(p[2])
mx=a
if b>mx:
mx=b
if c>mx:
mx=c
sys.stdout.write(str(mx))
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!