#include <stdio.h>
char jinzhi(int n,int p)
{
int temp;
char jinzhi[32] = {0};
int k = 31;
while(n != 0)
{
temp = n % p;
jinzhi[k] = temp;
n = n / p;
k--;
}
printf("%d进制数为:\n",p);
for(k = 0;k < 32;k++)
{
printf("%X",jinzhi[k]);
}
printf("\n");
return 0;
}
int main()
{
char jinzhi(int n,int p);
int n,p;
printf("输入数字: ");
scanf("%d",&n);
printf("输入进制:");
scanf("%d",&p);
jinzhi(n,p);
return 0;
}
整数进行任意进制转换
最新推荐文章于 2023-03-09 22:45:10 发布