While Loop in C
Level 384 keystrokes
Uses a while loop to count down from 5 to 1, then prints Go!
C code
// Starting value of the countdown1int count = 5;// The condition is checked before each pass; the loop stops when count reaches 02while (count > 0) { // Print the current value and a space3 printf("%d ", count); // Subtract 1; without this the loop would never end4 count--;5}// Runs once after the loop, completing the line: 5 4 3 2 1 Go!6printf("Go!\n");Output
5 4 3 2 1 Go!
Practice typing this code. Results are not recorded in the rankings.
Symbols in this code
The symbols you type in this C code and how often they appear.
;× 4"× 4(× 3)× 3-× 2,× 1!× 1{× 1}× 1\× 1