Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main() {
- int rows=5;
- int cols=6;
- int i, j;
- int mat[rows][cols]={
- {57,67,77,87,97,107 },
- {117, 127, 137, 147,157,167},
- {177, 187, 197, 207,217,227},
- {237, 247, 257, 267,277,287},
- {297, 307, 317, 327,337,347}
- };
- printf("Matrix values are:\n");
- for(i=0; i<rows; i++) {
- for(j=0;j<cols;j++) {
- printf("%d ", mat[i][j]);
- printf("\n");
- }
- }
- printf("Two Dimensional array elements on even coordinate:\n");
- for(i=0; i<rows; i++) {
- for(j=0;j<cols;j++) {
- if( i%2 ==0 && j%2==0){
- printf("%d ", mat[i][j]);
- printf("\n");
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment