Trebuie sa rezolv doua dintre cerințele acestea. Va rog mult repede
Răspunsuri la întrebare
Răspuns:
1)
#include <iostream>
using namespace std;
int main()
{
int n,m,i,j;
cout<<"n=";
cin>>n;
cout<<"m=";
cin>>m;
int a[n][m];
for(i=1;i<=n;i++)
for(j=1;j<=m;j++)
{
cout<<"a["<<i<<"]["<<j<<"]=";
cin>>a[i][j];
}
for(i=1;i<=n;i++)
{
for(j=1;j<=m;j++)
cout<<a[i][j]<<" ";
cout<<endl;
}
return 0;
}
2)
#include <iostream>
using namespace std;
int main()
{
int n,m,i,j,nr=0;
cout<<"n=";
cin>>n;
cout<<"m=";
cin>>m;
int a[n][m];
for(i=1;i<=n;i++)
for(j=1;j<=m;j++)
{
cout<<"a["<<i<<"]["<<j<<"]=";
cin>>a[i][j];
}
for(i=1;i<=n;i++)
for(j=1;j<=m;j++)
if(a[i][j]%2==0)
nr++;
cout<<nr;
return 0;
}
Explicație:
Multumesc+5*+cel mai inteligent raspuns?