Einfach 0 gelöst 0% Erfolgsquote

Largest of Three

Pick the largest of three numbers without a built-in max.

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.

Einschränkungen

-1,000,000,000 ≤ a, b, c ≤ 1,000,000,000

Beispiele

Beispiel 1
Eingabe:
a = 3
b = 9
c = 4

Erwartete Ausgabe:
expected = 9
Eingabe:
long long a = 3;
long long b = 9;
long long c = 4;

Erwartete Ausgabe:
long long expected = 9;
Eingabe:
long a = 3;
long b = 9;
long c = 4;

Erwartete Ausgabe:
long expected = 9;

Erläuterung

9 is greater than both 3 and 4.

Beispiel 2
Eingabe:
a = -5
b = -2
c = -2

Erwartete Ausgabe:
expected = -2
Eingabe:
long long a = -5;
long long b = -2;
long long c = -2;

Erwartete Ausgabe:
long long expected = -2;
Eingabe:
long a = -5;
long b = -2;
long c = -2;

Erwartete Ausgabe:
long expected = -2;

Erläuterung

-2 appears twice and is the largest value.

Referenzen

Diese Aufgabe wurde für CodeUtility angepasst. Beachte die oben genannten Vorgaben und Einschränkungen.

Von anderen lernen

Community-Lösungen

Noch keine veröffentlichten Lösungen. Löse die Aufgabe und teile als Erster eine Lösung.