Count down in twos · Comptez à reculons par deux
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.
Compter vers le bas par deux
n commence à 10. Imprimez 10, 8, 6, 4, 2 à l'aide d'une boucle while.
Le pas ne doit pas être 1. Vérifiez où il s'arrête : de 10 prenant 2 à chaque fois, la valeur après 2 est 0, et 0 > 0 est faux — donc 0 n'est jamais imprimé.
n starts at 10. Print 10, 8, 6, 4, 2 using a while loop. · n commence à 10. Imprimez 10, 8, 6, 4, 2 à l'aide d'une boucle while.
Click Run to see the output here. · Cliquez sur Exécuter pour voir le résultat ici.