here is my code:
#include <iostream.h>
#include <conio.h>
int main()
{
clrscr();
int A[10][10],m,n,x,y,sum=0;
// Ndertojme nje Matrice A
cout << "Ju lutemi vendosni numrin e rreshtave dhe te shtyllave per matricen A : \n";
cin>>n>>m;
cout << "Vendosni elementet e matrices A duke perdorur hapesine pas cdo elementi dhe enter per te kaluar tek rreshti tieter : \n";
for(x=1;x<n+1;++x)
for(y=1;y<m+1;++y)
cin>>A[x][y];
//Shuma e cdo rreshti
for(x=1;x<n+1;++x)
{
A[x][m+1]=0;
for(y=1;y<m+1;++y)
A[x][m+1]=A[x][m+1]+A[x][y];
}
//Shuma e cdo kolone
for(y=1;y<m+1;++y)
{
A[n+1][y]=0;
for(x=1;x<n+1;++x)
A[n+1][y]+=A[x][y];
}
cout << "\nMatrica A dhe shuma e rreshtave(kolona fundit)" << " Shuma kolonave (rreshti fundit) : \n";
for(x=1;x<n+1;++x)
{
for(y=1;y<m+2;++y)
cout << A[x][y] << " ";
cout << "\n";
}
//Printo shumen e cdo rreshti
x=n+1;
for(y=1;y<m+1;++y)
cout << A[x][y] << " ";
cout << "\n";
if(m==n)
{
for(x=1;x<m+1;x++)
for(y=1;y<n+1;y++)
if(x==y)
sum+=A[x][y];
else
if(y==m-(x+1))
sum+=A[x][y];
}
cout << "Shuma e elementeve te diagonales eshte : " << sum << endl;
getch();
return 0;
}
now i need to find the max of the last printed row
and print it
thank you in advance.