모든 챌린지
쉬움 0명 해결 정답률 0%

Average of Three

Average three whole numbers.

Compute the average (arithmetic mean) of three integers. The result can have a fractional part.

Implement average_of_three(a, b, c).

Input

a: The first number. b: The second number. c: The third number.

Output

Return (a + b + c) / 3 as a decimal number.

제약 조건

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

예시

예시 1
입력:
a = 2
b = 4
c = 9

예상 출력:
expected = 5.0
입력:
long long a = 2;
long long b = 4;
long long c = 9;

예상 출력:
double expected = 5.0;
입력:
long a = 2;
long b = 4;
long c = 9;

예상 출력:
double expected = 5.0;

설명

2 + 4 + 9 = 15 and 15 / 3 = 5.

예시 2
입력:
a = 1
b = 2
c = 2

예상 출력:
expected = 1.666667
입력:
long long a = 1;
long long b = 2;
long long c = 2;

예상 출력:
double expected = 1.666667;
입력:
long a = 1;
long b = 2;
long c = 2;

예상 출력:
double expected = 1.666667;

설명

1 + 2 + 2 = 5 and 5 / 3 ≈ 1.666667. Divide as decimals, not whole numbers.

참고 자료

이 문제는 CodeUtility에 맞게 수정되었습니다. 위의 설명과 제한 조건을 따르세요.

다른 사람의 풀이 보기

커뮤니티 솔루션

아직 공개된 풀이가 없습니다. 문제를 풀고 첫 풀이를 공유하세요.