Modulo Assignment in C++
Level 238 keystrokes
Replaces x with the remainder of 17 divided by 5 using %=, and prints 2.
C++ code
// Initializes x with 171int x = 17;// x %= 5 means x = x % 5; 17 = 5 * 3 + 2, so x becomes 22x %= 5;// Prints the remainder, 23cout << x << endl;Output
2
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;× 3=× 2%× 1