Advertisement
STANAANDREY

ex2_17/4/2019

Apr 17th, 2019
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. { int a[101][101],m,n,i,j,nr0=0,nrneg=0,nrpoz=0;
  6. cout<<"n=";cin>>n;
  7. cout<<"m=";cin>>m;
  8. for( i=0;i<n;i++)
  9. for( j=0;j<m;j++)
  10. cin>>a[i][j];//*/
  11.  
  12. for(int i=0;i<n;i++)
  13. for(int j=0;j<m;j++)
  14. {
  15.     if (!a[i][j])
  16.      nr0++;
  17.      else
  18.         if (a[i][j]>0)
  19.          nrpoz++;
  20.      else
  21.         nrneg++;
  22. }
  23.  cout<<"pozitve:"<<nrpoz<<endl;
  24.  cout<<"nule:"<<nr0<<endl;
  25.  cout<<"negative:"<<nrneg;
  26.    return 0; }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement