0

Upon dividing 2.4/0.8 we will get output as 3.00 Upon applying floor am getting the output as 2.00 But my expectation is floor(2.4/0.8) == floor(3.00). But the result of floor(2.4/0.8) gives 2 instead of 3.

I can't visualize what is going wrong here.

#include<iostream>
#include <cmath>


int main()
{
   double d=2.4/0.8;

   printf("\n  :: %lf ",d);
   printf("\n  :: %lf ",floor(d)  );

   return 0;
}

OUTPUT:

 :: 3.000000
 :: 2.000000
VINOTH ENERGETIC
  • 1,775
  • 4
  • 23
  • 38

0 Answers0