Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- unsigned Count(unsigned a, unsigned b)
- {
- unsigned x[10] = {0}, y[10] = {0}, i, count = 0;
- do {
- x[a % 10] = 1;
- a /= 10;
- }while(a);
- do {
- y[b % 10] = 1;
- b /= 10;
- }while(b);
- for(i = 0; i < 10; i++)
- count += x[i] & y[i];
- return count;
- }
- int main()
- {
- unsigned a, b;
- printf("a = "); scanf("%u", &a);
- printf("b = "); scanf("%u", &b);
- printf("count = %u\n", Count(a, b));
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement