C Reference function ldiv()
The integral quotient and remainder of the division of numerator by denominator integer n,d
Usage of ldiv():
ldiv_t ldiv ( long int n, long int d );
Parameters:
n = numerator
d = denominator
Return value:
Returns structure with ldiv_t.quot and ldiv_t.rem.
Source code example of ldiv():
#include<stdio.h>
#include<stdlib.h>
int main ()
{
ldiv_t result;
result = ldiv (1000L,256L);
printf ("1000 div 256 = %ld, remainder %ld.\n",result.quot,result.rem);
return 0;
}
Output of the ldiv example program above:
1000 div 256 = 3 remainder 232
This entry was posted in C Reference stdlib.h Functions.
You can follow any responses to this entry through the RSS 2.0 feed.
Both comments and pings are currently closed.
Tweet This! or use
to share this post with others.