Advertisement
adibahbab4108

C211009-ADIB

Nov 3rd, 2021
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.57 KB | None | 0 0
  1. //the number of products that  Kajol and Safa both own.
  2.  
  3. #include <bits/stdc++.h>
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.  
  9.     int n,m;
  10.     int i,j;
  11.     cin>>n>>m;
  12.     int count=0;
  13.     int kajol[n],safa[m];
  14.  
  15.     for(i=0; i<n; i++)
  16.     {
  17.         cin>>kajol[i];
  18.     }
  19.     for(j=0; j<m; j++)
  20.     {
  21.         cin>>safa[j];
  22.     }
  23.  
  24.     //int M=max(n,m);
  25.  
  26.     for(i=0; i<n; i++)
  27.     {
  28.         for(j=0; j<m; j++)
  29.         {
  30.             if(kajol[i]==safa[j])
  31.             {
  32.                 count++;
  33.  
  34.             }
  35.         }
  36.     }
  37.     cout<<count;
  38.     return 0;
  39. }
  40.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement