← C++ from Scratch Lesson 6 of 62 · 5 XP

Warm-up: double the number warm-up

Theory and problem statement

Machine translation, not yet reviewed by a native speaker.

std::cin >> reads a value from the input into a variable, and std::cout << prints. The arrows show where the value "flows":

int n;
std::cin >> n;                 // from the input into n
std::cout << n * 2 << '\n';    // from n to the screen

Task. Read an integer and print it multiplied by 2.

Sign up for free to solve this task right in your browser: code editor, running, test checks and hints.