QUESTION 30
After the following statements execute, what are the contents of matrix?
int matrix[3][2];
int j,
for (j = 0; j < 3; j++)
for (k = 0; k < 2; k++)
matrix[j][k] = j + k;
1. 0 0
1 1
2 2
2. 0 1
2 3
4 5
3. 0 1
1 2
2 3
4. 1 1
2 2
3 3
using namespace std;
#include <stdio.h>
//After the following statements execute, what are the contents of matrix?
main(void)
{
int matrix[3][2];
int j,k;
cout<<"\n";
for (j = 0; j < 3; j++)
{
for (k = 0; k < 2; k++)
{
matrix[j][k] = j + k;
cout<<"\t"<<matrix[j][k];
}
cout<<endl;
}
return(0);
}
Final Answer: Option [3]
0 1
1 2
2 3
Comments
Leave a comment