Add up to five · Somar até cinco
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.
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.
Use a while loop to add 1 + 2 + 3 + 4 + 5 into · em total. total should end as 15. · Use um loop while para somar 1 + 2 + 3 + 4 + 5 em total. total deve terminar como 15.
Click Run to see the output here. · Clique em Executar para ver a saída aqui.