Advertisement
Guest User

Untitled

a guest
Aug 27th, 2021
19
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. #include<stdio.h>
  2.  
  3. unsigned Count(unsigned a, unsigned b)
  4. {
  5. unsigned x[10] = {0}, y[10] = {0}, i, count = 0;
  6. do {
  7. x[a % 10] = 1;
  8. a /= 10;
  9. }while(a);
  10. do {
  11. y[b % 10] = 1;
  12. b /= 10;
  13. }while(b);
  14. for(i = 0; i < 10; i++)
  15. count += x[i] & y[i];
  16. return count;
  17. }
  18.  
  19. int main()
  20. {
  21. unsigned a, b;
  22. printf("a = "); scanf("%u", &a);
  23. printf("b = "); scanf("%u", &b);
  24. printf("count = %u\n", Count(a, b));
  25. return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement