谢谢楼上老师解答!
我试了一个,感觉不稳定。
#include <stdio.h>
#include <math.h>
main()
{
double a,b,t;
printf("请输入两个浮点数\n");
scanf("%lf,%lf",&a,&b);
t=a/b;
printf("a=%lf\n",a);
printf("b=%lf\n",b);
printf("计算结果=%lf\n",t);
int h;
h=(int)t;
printf("h=%d\n",h);
if (t-h==0)
printf("整除\n");
else
printf("不整除\n");
}
运行结果
请输入两个浮点数
99.1,0.1
a=99.100000
b=0.100000
计算结果=991.000000
h=990
不整除
Press any key to continue
991.000000转成整型后是h=990 出错
有得数字倒可以。