If N is 4 and m is the matrix displayed below, which code fragment below stores 1's along m's main diagonal and leaves all other entries unchanged?

```
m 0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
```

a. for ( int i = 1; i < N; ++i )
for ( int j = i; j <= N; ++j )
m[i][j] = 1;

b. for ( int i = 1; i < N; ++i )
m[i][i] = 1;
c. for ( int i = 0; i < N; ++i )
for ( int j = i; j <= N; ++j )
m[i][j] = 1;

d. for ( int i = 0; i < N; ++i )
m[i][i] = 1;

d. for ( int i = 0; i < N; ++i )
m[i][i] = 1;

Computer Science & Information Technology

You might also like to view...

The rating system that recognizes devices that use an average of 20 to 30 percent less energy than comparable devices is EPEAT

Indicate whether the statement is true or false

Computer Science & Information Technology

Press the ________ key during a presentation to see a list of slide show controls

Fill in the blank(s) with correct word

Computer Science & Information Technology