Count up to five · Comptez jusqu'à cinq
Count up to five
Use a while loop to print 1 to 5, one per line. Start n at 1.
Counting up needs n = n + 1 instead of n - 1, and a question that stops at the right place. n <= 5 lets 5 through; n < 5 would stop one early.
Compter jusqu'à cinq
Utilisez une boucle while pour imprimer 1 à 5, un par ligne. Commencez n à 1.
Le comptage ascendant nécessite n = n + 1 au lieu de n - 1, et une question qui s'arrête au bon moment. n <= 5 laisse passer 5 ; n < 5 s'arrêterait un peu tôt.
Use a while loop to print 1 to · à 5, one per line. Start n at 1. · Utilisez une boucle while pour imprimer 1 à 5, un par ligne. Commencez n à 1.
Click Run to see the output here. · Cliquez sur Exécuter pour voir le résultat ici.