Advertisement
Guest User

Untitled

a guest
Jan 21st, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int zapis (int broj1, int broj2) {
  5.  
  6. int x, y;
  7. int broj_cifara1=0, broj_cifara2=0;
  8. int cifra1, cifra2;
  9. int i, j, k=0;
  10.  
  11. x=broj1;
  12. y=broj2;
  13.  
  14. while(broj1>0) {
  15. broj1/=10;
  16. broj_cifara1++;
  17. }
  18. while(broj2>0) {
  19. broj2/=10;
  20. broj_cifara2++;
  21. }
  22. for(i=0; i<broj_cifara1; i++) {
  23. cifra1=x%10;
  24. x/=10;
  25. for(j=0; j<broj_cifara2; j++) {
  26. cifra2=y%10;
  27. y/=10;
  28. if(cifra1==cifra2) k++;
  29. }
  30. }
  31.  
  32. return k==broj_cifara1 ? 1 : 0;
  33.  
  34. }
  35.  
  36. int main()
  37. {
  38. int x, y;
  39. scanf("%d%d", &x, &y);
  40.  
  41. if(zapis(x, y))printf("sve cifre su jednake\n");
  42. else printf("nisu iste cifre");
  43. return 0;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement