Answer to Question #234522 in C++ for B,J

Question #234522

Declares an array of 20 components; initializes list[0] to 4 and list[1] to 7; all other components are initialized to 0.


1
Expert's answer
2021-09-07T15:48:34-0400
#include<iostream>
using namespace std;
int main(){
	int list[20];
	list[0] = 4;
	list[1]  = 7;
	for(int i=2; i<20; i++){
		list[i] = 0;
	}
	cout<<"Printing the elements of the list\n";
	for(int i=0; i<20; i++){
		cout<<list[i]<<endl;
	}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS