Răspuns :
Răspuns:
#include <iostream>
using namespace std;
int main()
{
int a[100][100],i,j,n,max=-99999,min=999999,k=0;
cout<<"Introduceti numarul de linii si de coloane ale matricei patratice: n= ";
cin>>n;
for(i=1;i<=n;i++)
for(j=1;j<=n;j++)
{
cout<<"a["<<i<<"]["<<j<<"]= ";
cin>>a[i][j];
}
cout<<"Elementele de pe diagonala secundara sunt: ";
for(i=1;i<=n;i++)
for(j=1;j<=n;j++)
if(i+j==n+1)
{
cout<<a[i][j]<<" ";
}
cout<<endl;
for(i=1;i<=n;i++)
for(j=1;j<=n;j++)
if(a[i][j]>max)
max=a[i][j];
cout<<"Indicii elementelor egale cu valoarea maxima sunt :";
for(i=1;i<=n;i++)
for(j=1;j<=n;j++)
if(a[i][j]==max)
cout<<i<<j<<" ";
cout<<endl;
cout<<"Elementele de deasupra diagonalei principale sunt :";
for(i=1;i<=n;i++)
for(j=1;j<=n;j++)
if(i<j)
cout<<a[i][j]<<" ";
cout<<endl;
for(i=1;i<=n;i++)
for(j=1;j<=n;j++)
if(a[i][j]<min)
min=a[i][j];
for(i=1;i<n;i++)
for(j=1;j<n;j++)
{
if(a[i][j]==min)
k++;
}
cout<<"Valoarea minima din matrice este "<<min<<" si apare de "<<k<<" ori";
}
Explicație: