Home Basic Loop Array string Function Pointer Contact STUDY

AHF    C    PROGRAM    SOLVING

Programming tips

Working with switch case



" ; " after loop



Header file



Iterative statement



Test expression




Array 2_D - transposed matrix




// AHF C PROGRAM SOLVING

//solving here 2_D   ARRAY 	programming problem

#include<stdio.h> #include<math.h> #define pf printf int main() { int i,j,arr[3][3],trs_arr[3][3]; pf("Enter the matrix: "); //taking data of a matrix for(i=0;i < 3;i++) { for(j=0;j < 3;j++) { pf("\nMATRIX[%d][%d] = ",i,j); scanf("%d",&arr[i][j]); } } pf("\nThe element of the matrix is: "); for(i=0;i < 3;i++) { pf("\n"); for(j=0;j < 3;j++) pf(" %d ",arr[i][j]); } pf("\nThe transposed matrix is: "); for(i=0;i < 3;i++) { pf("\n"); for(j=0;j < 3;j++) { trs_arr[i][j]=arr[j][i]; pf(" %d ",trs_arr[i][j]); } } return 0; }
OUTPUT:


© 2018 - All rights reserved