167k views
3 votes
2.Use loops to create a 4X6 matrix in which the value of each element is two times its row number minus three times its column number. For example, the value of element (2,5) is 2x2-3x5=-11.

1 Answer

3 votes

Answer:

for(i=0; i<4; i++)

{

for(j=0;j<6;j++)

{

A[ i ][ j ] = 2* i - 3*j;

}

}

Step-by-step explanation:

In this loop for each i = 0,1,2,3 we fill the the corresponding column values. and then move to next i value i.e. row.

User Thoughtrepo
by
7.7k points