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( ) The above code snippet would give the output as 2.150000.
{
printf ( “%f”, fmod ( 5.15, 3.0 ) ) ;
}