【求助】输入一个数,求二进制,八进制,十六进制转换。如何倒序输出啊,谢谢拉!!
#include<stdio.h>void trans(int n,int base)
{
if(n>0)
{
if(n%base>=10)
{
switch(n%base)
{
case 10:printf("A");break;
case 11:printf("B");break;
case 12:printf("C");break;
case 13:printf("D");break;
case 14:printf("E");break;
case 15:printf("F");break;
}
}
else printf("%d",n%base);
}
}
int main(void)
{
int n,base;
char b;
printf("Please input a decimal number whatever you want:");
scanf("%d",&n);
printf("Please input the base which you want to make into:");
scanf("%d",&base);
\*这里少一句*\
printf("\n");
}