2 Darray
2 Darray
// #include<iostream>
// using namespace std;
// int main()
// {
// int m, n, sum=0;
// int a[3][4] , b[4][2] ,r[3][2];
// cout<<"Enter your fist matrix";
// for(int i=0 ; i<3 ;i++)
// {
// for(int j=0 ; j<4 ;j++)
// {
// cin>>a[i][j];
// }
// }
// }
// r[i][j]=sum;
// sum=0;
// }
// }
// }
// cout<<endl;
// }
// return 0;
// }
2.
// #include<iostream>
// using namespace std;
// int main ()
// {
// int m, n, i, j, A[10][10];
// cout << "Enter the number of rows and columns of the matrix : ";
// cin >> m >> n;
// cout << "Enter the array elements : ";
// for (i = 0; i < m; i++)
// for (j = 0; j < n; j++)
// cin >> A[i][j];
// cout << "Matrix : \n ";
// for (i = 0; i < m; i++)
// {
// for (j = 0; j < n; j++)
// cout << A[i][j] << " ";
// cout << "\n ";
// }
// if (m == n)
// cout << "The entered array is a square matrix.";
// else
// {
// cout << "The entered array is not a square matrix.";
// exit(0);
// }
// cout << "The diagonal elements are : \n";
// for (i = 0; i < m; i++)
// {
// for (j = 0; j < n; j++)
// {
// if (i == j)
// cout << A[i][j];
// else
// cout << " ";
// }
// cout << "\n";
// }
// return 0;
// }