Question: This code finds the first row of an n-by-n integer matrix named x that has nothing but 0 values. Here is the code in C.

This code finds the first row of an n-by-n integer matrix named x that has nothing but 0 values. Here is the code in C.

include

int main(void)

{

int x[4][4] = {{0, 0, 0, 0},{0, 1, 2, 3}};

int n=4;

int i, j;

int r=-1;

for (i = 0; i < n; i++) {

for (j = 0; j < n; j++){

if (x[i][j] != 0){

goto reject;

}

}

r=i;

break;

}

reject: printf (" First all-zero row is: %d", r);

return 0;

}

Rewrite this code without gotos in C++, Java, or C#. If you can explain how I would go about solving this I would greatly appreciate it.

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!