Intel® C++ Compiler
Support and discussions for creating C++ code that runs on platforms based on Intel® processors.
7724 Discussions

How to display the array elements in C++ (1, 2, 3, 7, 9, 11, 21)?

AnkitTech
Beginner
220 Views

 

{
int numbers[6] = {1, 2, 3, 7, 9, 11, 21};

cout << "The numbers are: ";

for (const int &n : numbers) {
cout << n << " ";
}


cout << "\nThe numbers are: ";


for (int i = 0; i < 6; ++i) {
cout << numbers[i] << " ";
}

0 Kudos
0 Replies
Reply