2008如何转化为60进制?
问题描述:
2008如何转化为60进制?
用课本《必修3》第43页的“除k取余法”,不知怎样写?
答
#include
#define MAX_LEN 10
void main()
{
int iDec = 2008;
int radix = 60;
int value[MAX_LEN] = {0};
int index = 0;
printf("2008的60进制数是:\n");
value[index] = iDec % radix;
while(value[index] != 0)
{
index++;
iDec /= radix;
value[index] = iDec % radix;
}
for(int i=index; i>=0; i--)
printf("%d ",value[i]);
printf("\n");
}