Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int main()
- {
- long long int num,a[100],r,i;
- while(cin>>num && (num>=0))
- {
- i=0;
- if(num==0)
- cout<<"0";
- while(num>0){
- a[i++]=num%3;
- num/=3;
- }
- for(long long int j=i-1;j>=0;j--)
- cout<<a[j];
- cout<<"\n";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement