Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int zapis (int broj1, int broj2) {
- int x, y;
- int broj_cifara1=0, broj_cifara2=0;
- int cifra1, cifra2;
- int i, j, k=0;
- x=broj1;
- y=broj2;
- while(broj1>0) {
- broj1/=10;
- broj_cifara1++;
- }
- while(broj2>0) {
- broj2/=10;
- broj_cifara2++;
- }
- for(i=0; i<broj_cifara1; i++) {
- cifra1=x%10;
- x/=10;
- for(j=0; j<broj_cifara2; j++) {
- cifra2=y%10;
- y/=10;
- if(cifra1==cifra2) k++;
- }
- }
- return k==broj_cifara1 ? 1 : 0;
- }
- int main()
- {
- int x, y;
- scanf("%d%d", &x, &y);
- if(zapis(x, y))printf("sve cifre su jednake\n");
- else printf("nisu iste cifre");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement