For Loop Step in C++
Level 255 keystrokes
Uses a for loop that adds 2 to i on each pass, printing the even numbers 0, 2, 4, 6, 8 and 10.
C++ code
// i starts at 0 and the loop runs while i <= 10// i += 2 makes the step 2 instead of 11for (int i = 0; i <= 10; i += 2) { // Prints 0, 2, 4, 6, 8 and 10, one per line2 cout << i << endl;3}Output
0 2 4 6 8 10
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.
<× 5;× 3=× 3(× 1)× 1{× 1}× 1+× 1