Answer:
In C++:
#include <iostream>
using namespace std;
int main(){
int nums[6] = {14, 36, 31, -2, 11, -6};
cout<<"[";
for(int i = 0;i<6;i++){
cout<<nums[i];
if(i != 5){cout<<", ";}
}
cout<<"]";
return 0;
}
Explanation:
This initializes the array
int nums[6] = {14, 36, 31, -2, 11, -6};
This prints the opening square bracket
cout<<"[";
This iterates through the array
for(int i = 0;i<6;i++){
This prints individual elements of the array
cout<<nums[i];
Until the last index, this line prints comma after individual array elements
<em> if(i != 5){cout<<", ";}</em>
}
This prints the closing square bracket
cout<<"]";