小数化分数,这个程序有什么错误,实在不知道该怎么办
/*小数化分数,非循环*/#include<stdio.h>
#include<ctype.h>
#include<math.h>
double zdgys(double c,double d)
{double o=1,p=1;
while(c/o!=d/p)
{while(c/o>d/p)
o++;
while(c/o<d/p)
p++;
}
while(c/o==d/p)
return (c/o);
}
double quzheng(double d)
{double dw;
int iw;
iw=d;
dw=iw;
return dw;
}
main()
{ double m,im,j=1,l;
/* clrscr(); */
printf("Input decimal fraction:\n");
scanf("%f",&m);
im=quzheng(m);
while(m!=im)
{m*=10;
j*=10;
im=quzheng(m);
}
l=zdgys(m,j);
m/=l;
j/=l;
printf("The fenshu is %f,%f",m,j);
}