Based on type conversion

Main()
{
printf("%d",(2.5*2.5));
}

above gives output of 0 plss explain

Questions by kartik1218

Showing Answers 1 - 6 of 6 Answers

sachinpatil

  • Feb 14th, 2008
 

by default the real number constants (i.e. 2.5 3.14 etc) are considered as double. Double is stored using IEEE floating point standard.
the (2.5 *2.5) gives double. when this double is passed to the printf and printed using %d. function assumes that argument is integer. So there is Data loss of 6 bytes.
and U can think what will be effect of loosing 6 bytes.

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions