Do-While Loop in C
Level 256 keystrokes
Uses a do-while loop, which runs its body once before checking the condition, to print n from 1 to 3: "1 2 3".
C code
// The counter n starts at 11int n = 1;// do starts the body, which always runs at least once2do { // Prints the current n followed by a space3 printf("%d ", n); // Adds 1 to n so the loop can end4 n++;// The condition is checked after each pass; when n becomes 4 the loop stops5} while (n <= 3);Output
1 2 3
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"× 2(× 2)× 2+× 2=× 2,× 1{× 1}× 1%× 1