KyaPoocha.com

Huge Collection of Interview Questions


Can we get the remainder of a floating point division ? 

Yes. Although the % operator fails to work on float numbers we can still get the remainder of floating point division by using a function fmod( ). The fmod( ) function divides the two float numbers passed to it as parameters and returns the remainder as a floating-point value. Following program shows fmod( ) function at work.

#include

main( )
{
printf ( “%f”, fmod ( 5.15, 3.0 ) ) ;
}

The above code snippet would give the output as 2.150000.



If you liked this question/asnwer, make sure you
Subscribe to KyaPoocha.com RSS feed!


BOOKMARK THIS : BlinkList | del.icio.us | Digg it | Furl | reddit | StumbleUpon | Yahoo MyWeb |