Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7956 Discussions

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

AnkitTech
Beginner
338 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