Count up to five · Contar hasta cinco
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.
Contar hasta cinco
Utilice un bucle while para imprimir del 1 al 5, uno por línea. Inicie n en 1.
Contar hacia arriba requiere n = n + 1 en lugar de n - 1, y una condición que se detenga en el momento adecuado. n <= 5 permite que el 5 sea incluido; n < 5 se detendría demasiado pronto.
Use a while loop to print 1 to · hasta 5, one per line. Start n at 1. · Usa un bucle while para imprimir del 1 al 5, uno por línea. Inicia n en 1.
Click Run to see the output here. · Haz clic en Ejecutar para ver la salida aquí.