<pre name="code" class="cpp"><strong><span style="font-size:18px;">/* Note:Your choice is C IDE */
#include "stdio.h"
Trans(int x,int base)
{
int i=0,a[100]={0};
if(base = 2)
{ for(x;x>0;i++)
{
a[i] = x%2;
x=x/2;
}
for(i;i > 0;i--)
{
printf("%d",a[i-1]);
}
}
}
void main()
{
int x,y;
printf("请输入需要转换的数值:\n");
scanf("%d",&x);
printf("请输入需要转换成的进制:\n");
scanf("%d进制",&y);
Trans(x,y);
}</span></strong>