Factorial (mind the size) · 계승 (크기에 주의)
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를 최신 버전으로 업데이트해 주세요.
Factorial (mind the size)
n! is 1 × 2 × … × n, and 0! is 1. It grows fast — 20! is over two billion billion — so the method returns a long, not an int, or the answer would overflow. Multiply from 2 up to n.
Complete factorial(int n) returning n! as a long (so large values fit). factorial(0) is 1. Assume 0 <= n <= 20. · factorial(int n)를 완성하여 n!을 long로 반환하도록 하십시오(큰 값도 처리 가능). factorial(0)은 1입니다. 0 <= n <= 20이라고 가정하십시오.
Click Run to see the output here. · 출력을 보려면 '실행'을 클릭하세요.