1 2 3 4 5
10 9 8 7 6
11 12 13 14 15
20 19 18 17 16
21 22 23 24 25
How to print the following matrix in c (5*5 array)?
printf("1 2 3 4 5\n");
printf("10 9 8 7 6\n");
printf("11 12 13 14 15\n");
printf("20 19 18 17 16\n");
printf("21 22 23 24 25\n");
Reply:int i,j;
for (i = 0; i %26lt; numrows; i++) {
for (j = 0; j %26lt; numcols; j++) {
printf("%d ",array[i][j]);
}
printf("\n");
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment