โจทย์
Return the largest of three integers. Practice comparisons with if statements; don't use a built-in max function.
Implement largest_of_three(a, b, c).
Input
a: The first number. b: The second number. c: The third number.
Output
Return the largest value.
เงื่อนไข
-1,000,000,000 ≤ a, b, c ≤ 1,000,000,000
ตัวอย่าง
ตัวอย่างที่ 1
อินพุต:
a = 3
b = 9
c = 4
ผลลัพธ์ที่คาดหวัง:
expected = 9
อินพุต:
long long a = 3;
long long b = 9;
long long c = 4;
ผลลัพธ์ที่คาดหวัง:
long long expected = 9;
อินพุต:
long a = 3;
long b = 9;
long c = 4;
ผลลัพธ์ที่คาดหวัง:
long expected = 9;
คำอธิบาย
9 is greater than both 3 and 4.
ตัวอย่างที่ 2
อินพุต:
a = -5
b = -2
c = -2
ผลลัพธ์ที่คาดหวัง:
expected = -2
อินพุต:
long long a = -5;
long long b = -2;
long long c = -2;
ผลลัพธ์ที่คาดหวัง:
long long expected = -2;
อินพุต:
long a = -5;
long b = -2;
long c = -2;
ผลลัพธ์ที่คาดหวัง:
long expected = -2;
คำอธิบาย
-2 appears twice and is the largest value.
แหล่งอ้างอิง
โจทย์นี้ปรับให้เหมาะกับ CodeUtility กรุณาทำตามคำชี้แจงและข้อจำกัดด้านบน