Advertisement
Dizzy3113

Untitled

Nov 10th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int cifre(int a, int b)
  6. {
  7. int x[10], y[10], c=0;
  8. for(int i=0; i<=9; i++)
  9. x[i]=0;
  10. for(int i=0; i<=9; i++)
  11. y[i]=0;
  12. while(a)
  13. {
  14. x[a%10]++;
  15. a=a/10;
  16. }
  17. while(b)
  18. {
  19. y[b%10]++;
  20. b=b/10;
  21. }
  22.  
  23. for(int i=0; i<=9; i++)
  24. if(x[i]>0 && y[i]>0)
  25. c++;
  26. return c;
  27. }
  28.  
  29.  
  30. int main()
  31. {
  32. cout<<cifre(123446, 248766);
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement