Coding basics · 8 of 20
Factorial
Return n! = 1 × 2 × … × n. By definition 0! is 1.
Jump to the editor ↓Examples
Input n = 5
Output 120
Input n = 0
Output 1
Coding basics · 8 of 20
Return n! = 1 × 2 × … × n. By definition 0! is 1.
Jump to the editor ↓Input n = 5
Output 120
Input n = 0
Output 1
Tab indents · ⌘/Ctrl+Enter runs · Esc leaves the editor