rt,想要实现判断一个数是否是有限小数,我写了这段代码。可是有问题。明明1/3,p=0.333333,b=3,为什么乘起来会变成1。
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
float a,b;
cin>>a>>b;
cout<<a<<" "<<b<<endl;
float p=a/b;
cout<<p<<endl<<p*b;
return 0;
}