← C++ from Scratch
Lesson 14 of 62 · 5 XP
Warm-up: positive? warm-up
Theory and problem statement
Machine translation, not yet reviewed by a native speaker.
if runs its block only when the condition in brackets is true, and else — when it is false:
if (n > 0) {
std::cout << "positive\n";
} else {
std::cout << "not positive\n";
}
Task. Read an integer and print positive if it is greater than zero, otherwise not positive.
Sign up for free to solve this task right in your browser: code editor, running, test checks and hints.