两道C语言的题,哪位高人指点一下, 不胜感激之致!!!

2024-11-17 01:42:02
推荐回答(1个)
回答1:

main()
{ /*进制转换*/
int m,n,i=0,j,a[20];
printf("enter the number you want to convert:\n");
scanf("%d",&n);
printf("enter the number you want to be converted to be:\n");
scanf("%d",&m);
do
{
i++;
a[i]=n%m;
n=n/m;

}while(n!=0);
for(j=i;j>=1;j--)
printf(" %d",a[j]);

getch();

}