Advertisement
CosminVarlan

Untitled

Nov 5th, 2018
170
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.  
  3. using namespace std;
  4.  
  5. int a[10] = {4,3,7,22,9,2,13,5,41,8};
  6.  
  7. int m[3][3] {{1,2,3},{4,5,6},{7,8,9}};
  8.  
  9. int c;
  10. int main()
  11. {
  12.     for (int k=0 ; k<10; k++ )
  13.     for(int i=2; i>=0; i--)
  14.     {
  15.         for(int j=2; j>=0; j--)
  16.             if ( m[i][j] == a[k])
  17.             {
  18.                 c++;
  19.                 cout << m[i][j] << " ";
  20.             }
  21.     }
  22.  
  23.     cout <<"\nIn total avem "<<c<< " elemente comune"<< endl;
  24.  
  25.     return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement