#include<stdio.h>
#include<conio.h>
#include<math.h>
int main()
{
int i,b,e,tmp,nod=0;
scanf("%d %d",&b,&e);
tmp = b;
while(tmp)
{
nod++;
tmp = tmp/e;
}
printf("\n");
while(nod>0)
{
nod--;
tmp = 1;
for(i=0;i<nod;i++)
tmp *= e;
if(e != 16)
printf("%d",b/tmp);
else
printf("%X",b/tmp);
b %= tmp;
}
getch();
return 0;
}
No comments:
Post a Comment