#include<stdio.h>
int main()
{
int i, N, rem[100], j;
while(scanf("%d",&N)==1)
{
if(N<0)
{
break;
}
i = 0;
while(N != 0)
{
rem[i] = N%3;
N = N/3;
i++;
}
for(j=i-1; j>=0; j--)
{
printf("%d",rem[j]);
}
printf("\n");
}
return 0;
}
int main()
{
int i, N, rem[100], j;
while(scanf("%d",&N)==1)
{
if(N<0)
{
break;
}
i = 0;
while(N != 0)
{
rem[i] = N%3;
N = N/3;
i++;
}
for(j=i-1; j>=0; j--)
{
printf("%d",rem[j]);
}
printf("\n");
}
return 0;
}
Comments
Post a Comment