Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Suma coloana 1 par, produs impar diag sec si ma linia 2

#include <iostream>

using namespace std;

int main()

{ int x[10][10], n, m, i, j, s=0, p=1, q=0, k=0, ma;

cout<<"Dati numarul de linii: "; cin>>n;

cout<<"Dati numarul de coloane: "; cin>>m;

cout<<"Introduceti elementele matricei: "<<endl;

for (i=1; i<=n; i++)

for (j=1; j<=m; j++)

cout<<"x["<<i<<"]["<<j<<"]=";

cin>>x[i][j];

cout<<"Afisam matricea: "<<endl;

for (i=1; i<=n; i++)

{ for (j=1; j<=m; j++)

cout<<x[i][j]<<" ";

cout<<endl; }

for(i=1; i<=n; i++)

if(x[i][1]%2==0)

s=s+x[i][1];

cout<<s;
cout<<endl;

for (i=1; i<=n; i++)

for (j=1; j<=m; j++)

{if(i+j==n+1)

if(x[i][j]%2!=0)

p=p*x[i][j];}

cout<<p;

cout<<endl;

for (j=1; j<=m; j++)

q=q+x[2][j];

k++;

ma=q/k;

cout<<ma;

return 0;

You might also like