Skip to content · ⁨Pular para o conteúdo⁩

Factorial (mind the size) · ⁨Fatorial (cuidado com o tamanho)⁩

English

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.

Português

Fatorial (cuidado com o tamanho)

n! é 1 × 2 × … × n, e 0! é 1. Cresce rápido — 20! é mais de dois bilhões de bilhões — então o método retorna um long, não um int, ou a resposta transbordaria. Multiplique de 2 até n.

Log in or create account · ⁨Entrar ou criar conta⁩

IGCSE, A-Level & AP