数值转换问题

#include<stdio.h>
#include<math.h>
#define  L 10
void  conversion(int N,int r)
{
   int s[L],top;
   int x;
   top=-1;
   while(N)
   {
      s[++top]=N%r;
   N=N/r;
   }
   while(top!=-1)
   {
    x=s[top--];
    printf("%d\n",x);
   }
   printf("\n");
}
main()
{
    int N,r;   
    scanf("%d%d",&N,&r);
 conversion(N,r);
 return  0;
}

posted @ 2011-08-11 17:19  bcy  阅读(154)  评论(0编辑  收藏  举报