Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int djeljiv_sa_tli(int n)
- {
- int cifra[50];
- int brojac=0,k=1,broj=n,i,novibroj=0,j,m=1;
- while(n!=0)
- {
- n/=10;
- brojac++;
- }
- n=broj;
- for(i=0;i<brojac;i++)
- {
- cifra[i]=n%10;
- if(cifra[i]%3==0) cifra[i]=0;
- novibroj+=cifra[i]*k;
- k*=10;
- n/=10;
- }
- for(i=0;i<brojac;i++)
- {
- cifra[i]=novibroj%10;
- if(cifra[i]!=0)
- j+=cifra[i]*m;
- m*=10;
- novibroj/10;
- }
- return j;
- }
- int main()
- {
- int x;
- printf("unesi broj:");
- scanf("%d",&x);
- printf("%d",djeljiv_sa_tli(x));
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment