C Program To Take Input A 2D Array Of 2x5 In Column Major Order
♣ Try it Out :: #include<stdio.h> #include<conio.h> #define row 2 #define col 5 main() { int arr[row][col], i, j; printf("Enter a 2x5 matrix in column major order: \n\n"); for(i=0; i<col; i++) for(j=0; j<row; j++) scanf("%d", &arr[j][i]); printf("\nYou have entered: \n\n"); for(i=0; i<row; i++) { for(j=0; j<col; j++) printf("a%d%d=%d\t", i, j, arr[i][j]); printf("\n"); } getch(); return(0); } ♣ Output :: Enter a 2x5 matrix in column major order: 1 2 3 4 5 6 7 8 9 0 You have entered: a00=1 a01=3 a02=5 a03=7 a04=9 a10=2 a11=4 a12=6 a13=8 a14=0 ♣ Downloads :: Download source code Download executable file