Problem
-------------------------------------------------------
-------------------------------------------------------
#include<stdio.h> int main() { long int n,a[2000],j,i; while(scanf("%ld",&n)==1) { if(n<0) break; i=0; if(n==0) printf("0"); while(n!=0) { a[i]=n%3; n=n/3; i++; } for(j=i-1;j>=0;j--) printf("%ld",a[j]); printf("\n"); } return 0;}
No comments:
Post a Comment