//by: 龍魂 email:[email protected] QQ:278563291
//datetime:2010/02/20 23:59

#include

void convert(unsigned int n, int conver_n)
{
         char s[32]={};             /*定义存储数组*/
         int i=0;                         /*定义数据下标计数器*/
         while (n)
        {
                s[i]=( "0123456789ABCDEF"[n%conver_n]);     /*转换进制方法*/
                n/=conver_n;
                ++i;
        }
         /*倒序打印*/
         int k;
         for (k=i-1;k>=0;k--)
        {
                printf( "%c",s[k]);
        }
}

int main( int argc, char *argv[])
{
         int n,conver_n;
        printf( "please input data: 6,2\n");
        scanf( "%d,%d",&n,&conver_n);
        convert(n,conver_n);
         return 0;
}