Arithmetic
What you are building
The task in front of you: What does 11667 % 2 give?.
The editor already holds a working starting point. Do not delete it and start again — read it, change one thing, run it, and watch which check moves. That loop is the whole method.
Why this matters
You are inside the section “Section 1 · First programs” of the C++ Foundations track. Everything in this section builds towards the section project, and this task is one of the pieces that project leans on.
In real work nobody marks your code — it either runs or it does not, and someone is waiting for the result. The checks here are deliberately strict about output, because a program that prints the right thing in the wrong shape fails in the real world too.
The key idea
C++ makes you say what type every value has, and the compiler believes you. That strictness is the point: the error you get at compile time is a bug you did not have to debug at runtime.
Every statement ends in a semicolon, and main() is where the program starts. Read compiler errors from the top: the first one is usually the real one.
Two mistakes to avoid
- Forgetting std:: or the namespace, then blaming the compiler. If it says "not declared", check the include and the namespace first.
- Declaring a variable inside an if block and using it after the block ends. The name only exists between the braces that created it.
What the automatic checks look for
The right-hand column runs 1 check every time you press Run code. Nothing is hidden:
- The output has to contain “out:Total: 35001 Half…”.
Task
What does 11667 % 2 give?
The editor already contains a starting point. Change it until every check passes — the Next task button unlocks when it does.
What you start with
#include <iostream>
using namespace std;
int main() {
int months = 3;
int monthly = 11667;
cout << "Total: " << months * monthly << endl;
cout << "Half: " << monthly / 2 << endl;
cout << "Remainder: " << monthly % 2 << endl;
return 0;
}
Run your code to see the output and the checks.
Submit your code to see results
Write your code in the middle column and press Run code.
Why this works
Checks on this task:
- Check 1
Stuck? The Hint button at the bottom nudges you one step without handing over the answer — that is on purpose: an exercise you copied teaches nothing.
Track progress
0 of 56 tasks complete
Next task unlocks when every check passes.
Sign in to keep your code and certificates.
Re-read the task: “What does 11667 % 2…”. Check three things before you run: the semicolon at the end of the line, the type of each variable, and that cout has << before every value. The output has to contain “out:Total: 35001 Half…”.
Still stuck? Re-read “What you are building” in the left column and change one line at a time. Press Run after every change.