← C++ from Scratch
Lesson 21 of 62 · 5 XP
Warm-up: three numbers in an array warm-up
Theory and problem statement
Machine translation, not yet reviewed by a native speaker.
An array is several values of the same type in a row. Elements are numbered from zero:
int a[3];
std::cin >> a[0] >> a[1] >> a[2];
std::cout << a[0] + a[1] + a[2] << '\n';
Task. Read three integers into the array a and print their sum.
Sign up for free to solve this task right in your browser: code editor, running, test checks and hints.