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

Add up to five · ⁨Somar até cinco⁩

English

Add up to five

Use a while loop to add 1 + 2 + 3 + 4 + 5 into total. total should end as 15.

Two things change every time round: the running total, and the counter n. Miss the counter and the loop never ends; miss the total and it ends with nothing in it.

Português

Somar até cinco

Use um loop while para somar 1 + 2 + 3 + 4 + 5 em total. total deve terminar como 15.

Duas coisas mudam a cada volta: a soma acumulada total, e o contador n. Perder o contador faz o loop nunca terminar; perder o total faz ele terminar vazio.

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

IGCSE, A-Level & AP