Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int main()
- {
- long int ter[1000],num,i,l,mod;
- while(scanf("%ld",&num)==1)
- {
- if(num<0) break;
- for(i=0;i<100;i++)
- {
- ter[i]=num%3;
- num=num/3;
- if (num==0)
- {
- l=i;
- break;
- }
- }
- for(i=l;i>=0;i--)
- {
- mod=ter[i];
- printf("%ld",mod);
- }
- printf("\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement