Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int cifre(int a, int b)
- {
- int x[10], y[10], c=0;
- for(int i=0; i<=9; i++)
- x[i]=0;
- for(int i=0; i<=9; i++)
- y[i]=0;
- while(a)
- {
- x[a%10]++;
- a=a/10;
- }
- while(b)
- {
- y[b%10]++;
- b=b/10;
- }
- for(int i=0; i<=9; i++)
- if(x[i]>0 && y[i]>0)
- c++;
- return c;
- }
- int main()
- {
- cout<<cifre(123446, 248766);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement