将十进制正整数m转换成k进制(2#include #include void fun(int m,int k)int aa[20],i;for(i=0;m;i++)aa[i]=m/k;m/=k;for(;i;i--)printf("%d",aa[i]);main()int b,n;clrscr();printf("enter a number and a base:");scanf("%d %d",&n,&b);fun(n,b);
问题描述:
将十进制正整数m转换成k进制(2
#include
#include
void fun(int m,int k)
int aa[20],i;
for(i=0;m;i++)
aa[i]=m/k;
m/=k;
for(;i;i--)
printf("%d",aa[i]);
main()
int b,n;
clrscr();
printf("enter a number and a base:");
scanf("%d %d",&n,&b);
fun(n,b);
答
#include #include void fun(int m,int k){int aa[20],i;for(i=1;m;i++){aa[i]=m%k;m/=k;}for(--i;i;i--)printf("%d",aa[i]);}main(){int b,n;clrscr();printf("enter a number and a base:");scanf("%d %d",&n,&b);...