进制转换问题
#include <stdio.h>#include<math.h>
#define MAX 10
void main()
{
int n,len1,len2,n1,i;
float N,n2;
char c;
int a[MAX+1];
int b[MAX+1];
char d[]="0123456789ABCDEF";
printf("Input a decimal integer and a base:");
scanf("%f%d",&N, &n);
n1=(int)N;
n2=N-n1;
printf("Converting...\n");
len1=0;
len2=0;
while (n1) {
a[len1]=n1%n;
n1=n1/n;
len1++;
}
while(n2){
b[len2]=(int)(n2*n);
n2=n2*n-(int)n2*n;
len2++;
}
printf("%f equals to ",N);
for (;len1>0;len1--){
i=a[len1];
printf("%c",d[i]);
}
if(len2!=0){
printf(".");
for (len2=1;len2<7;len2++)
{
i=b[len2];
printf("%c",d[i]);
}
}
printf("\n");
}
麻烦看一下哪里错了