Skip to content · ⁨Saltar al contenido⁩

Count down in twos · ⁨Cuenta regresiva de dos en dos⁩

English

Count down in twos

n starts at 10. Print 10, 8, 6, 4, 2 using a while loop.

The step does not have to be 1. Check where it stops: from 10 taking 2 each time, the value after 2 is 0, and 0 > 0 is false — so 0 is never printed.

Español

Cuenta regresiva de dos en dos

n comienza en 10. Imprime 10, 8, 6, 4, 2 utilizando un bucle while.

El paso no tiene por qué ser 1. Observa dónde se detiene: partiendo de 10 y restando 2 en cada iteración, el valor posterior a 2 es 0, y como 0 > 0 es falso —entonces 0 nunca se imprime—.

Log in or create account · ⁨Iniciar sesión o crear cuenta⁩

IGCSE, A-Level & AP