Advertisement
Guest User

Untitled

a guest
Sep 20th, 2019
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int p,s,n,m,i,j,a[50][50];
  8. s=0;
  9. p=1;
  10. cout<<"m= ";cin>>m;
  11. cout<<"n= ";cin>>n;
  12. for(i=0;i<m;i++)
  13. for(j=0;j<n;j++)
  14. {cout<<"a["<<i+1<<","<<j+1<<"]=";
  15. cin>>a[i][j];
  16. cout<<endl;
  17. }
  18. s=0;
  19. for(i=0;i<m;i++)
  20. for(j=0;j<n;j++)
  21. {if(a[i][j]>0)
  22. {
  23. s=s+a[i][j];
  24. }
  25. }cout<<"Suma este= "<<s<<endl;
  26. for(i=0;i<m;i++)
  27. for(j=0;j<n;j++)
  28. {
  29. if(a[i][j]>0)
  30. {
  31. if(a[i][j]%2==0)
  32. {
  33. p=p*a[i][j];
  34. }
  35. }
  36. }
  37. cout<<"Produsul este= "<<p;
  38. return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement