问题描述:
希望大家帮帮忙,不胜感激!!
问题解答:
这个程序只能转化成1到16进制数
#include <stdio.h>
void main()
{
long m;
int i=0,d,n,a[50],b[]={'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
printf("please input the munber:\n");
scanf("%ld",&m);
printf("please input the base:\n");
scanf("%d",&n);
do{a[i]=m%n;i++;}while((m/=n)!=0);
printf("the new number is:\n");
for(--i;i>=0;i--)
{d=a[i];printf("%c ",b[d]);
}
printf("\n");
}
我也是刚刚学C,还请高手多多指教!!在VC上已经运行成功!
送你四个字:太不讲就!!!以后都不会再帮你!