Subtraction Assignment in C++
Level 273 keystrokes
Subtracts 25 and then 30 from balance with -=, so 100 becomes 45, and prints 45.
C++ code
// Initializes the balance with 1001int balance = 100;// balance -= 25 means balance = balance - 25: 100 - 25 = 752balance -= 25;// Subtracts 30 more: 75 - 30 = 453balance -= 30;// Prints the remaining balance, 454cout << balance << endl;Output
45
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-× 2