Question: What does the following code do, given that x is initialized with integer values? int row = 5; int col = 5; int x[row][col]; /*

What does the following code do, given that x is initialized with integer values?
int row = 5;
int col = 5;
int x[row][col];
/* Intilization of x */
for (int i = 0; i < row; i++ )
if (x[i][i] % 3 == 0)
x[i][i] = 1;
else
x[i][i] = 0;
For all elements in x, change its value to 0 if its even or to 1 if its odd.
For all elements on x diagonal line, change its value to 0 if its multiple of 3 or to 1 if its odd.
For all elements in x, change its value to 1 if its even or to 0 if its odd
For all elements on x diagonal line, change its value to 1 if its multiple of 3 or to 0 if its odd.
None of the answers

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!