@Srivastav: Yeah. You need more parens: printf("%d",(int)(3.14*6.25*6.25));
Without the extra parens, the 3.14 is cast to an int, but then implicitly recast to a double for the multiplications. With the parens, the product is formed in type double, and then the result is cast into integer. Sorry for not recognizing the need before. Dave On Sep 6, 5:18 pm, UTKARSH SRIVASTAV <usrivastav...@gmail.com> wrote: > printf behaves abnormally when it sees arguments not matching with its > datatype............ > @dave > printf("%d",(int)3.14*6.25*6.25); is also giving 0. > > -- > *UTKARSH SRIVASTAV > CSE-3 > B-Tech 3rd Year > @MNNIT ALLAHABAD* -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.