You are on page 1of 3

P R O G R A M M E P E R M E T TA N T D E C A L C U L E R L A M AT R I C E T R A N S P O S É E E T L A S O M M E D E D I A G O N A L E

D r BO U D J E MA A K h e lif a
P R ES EN TE D BY: A BI D AT M o h a m m e d

M A S T E R 1 R É S E A U X E T T É L É C O M M U N I C AT I O N

2022-2023
#include <iostream>
using namespace std;
int main()
{
int a[10][10], transpose[10][10], row, column, i, j,m,s;
cout << "Enter rows and columns of matrix: ";
cin >> row >> column;
cout << "\nEnter elements of matrix: " << endl;

for (int i = 0; i < row; ++i)


{
for (int j = 0; j < column; ++j)
{
cout << "Enter element a" << i + 1 << j + 1 << ": ";
cin >> a[i][j];
}
}
cout << "\nEntered Matrix: " << endl;
for (int i = 0; i < row; ++i)
{
for (int j = 0; j < column; ++j)
{
cout << " " << a[i][j];
if (j == column - 1)
cout << endl << endl;
}
}
for (int i = 0; i < row; ++i)
for (int j = 0; j < column; ++j)
{
transpose[j][i] = a[i][j];
}

cout << "\nTranspose of Matrix: " << endl;


for (int i = 0; i < column; ++i)
for (int j = 0; j < row; ++j)
{
cout << " " << transpose[i][j];
if (j == row - 1)
cout << endl << endl;
}
m=0; s=0;
for (int i = 0; i < column; ++i)
{
m=s+a[i][i];
s=m;
}
cout<<"la somme"<<s;
return 0;}
THANK YOU

You might also like