Factorial · 계승(factorial)
This page needs a recent browser (with SharedArrayBuffer support). Please update Chrome, Edge, Firefox or Safari to the latest version. · 이 페이지는 최신 브라우저(SharedArrayBuffer 지원)가 필요합니다. Chrome, Edge, Firefox 또는 Safari를 최신 버전으로 업데이트해 주세요.
English
Factorial
The factorial n! is the product 1 * 2 * 3 * ... * n. By definition 0! is 1.
Start a result at 1, then multiply it by every integer from 2 up to n in a loop. (The tests keep n at most 10, so the answer fits in an int.)
한국어
계승(factorial)
n!의 계승(factorial)은 1 * 2 * 3 * ... * n의 곱입니다. 정의에 따라 0!은 1입니다.
결과를 1으로 초기화한 후, 2부터 n까지 모든 정수를 루프에서 곱합니다. (테스트는 n을 최대 10로 유지하므로, 답은 int에 들어갑니다.)
Complete int factorial(int n) to return n! = 1 * 2 * ... * n. Assume 0 <= n <= 10, and factorial(0) is 1. · int factorial(int n)를 완성하여 n! = 1 * 2 * ... * n를 반환합니다. 0 <= n <= 10가 성립하며, factorial(0)는 1입니다.
Click Run to see the output here. · 출력을 보려면 '실행'을 클릭하세요.