main()
{
float a=0.7;
if(0.7>a)
{
cout<<("true");
}
else
{
cout<<("false");
}
}
Question : why the output of this program is true ?
nd when i take the value of a is 0.6 then it is false ??
1
Expert's answer
2014-09-02T05:43:34-0400
Dear visitor,
It happens because you use the float data type. it is known for its imprecision. If you want to have the correct work in such cases, it is better to use double. They are called double precision type for a reason.
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
Finding a professional expert in "partial differential equations" in the advanced level is difficult.
You can find this expert in "Assignmentexpert.com" with confidence.
Exceptional experts! I appreciate your help. God bless you!
Comments
Leave a comment