Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int a[51][51],m,n,i,j,nr;
  8. cin>>m>>n;
  9. for(i=1;i<=m;i++)
  10. for(j=1;j<=n;j++)
  11. cin>>a[i][j];
  12.  
  13. for(j=1;j<=n;j++)
  14. {
  15. nr=0;
  16. for(i=1;i<m;i++)
  17. if(a[i][j]==a[i+1][j])
  18. nr++;
  19. if(nr==m-1)
  20. cout<<a[i][j]<<" ";
  21. }
  22. return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement