Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Zortech C++ Language Reference - ldiv http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
   ldiv

   Usage
   #include <stdlib.h>

   ldiv_t ldiv(long int numerator, long int denominator)

   Description
   The ldiv function divides the numerator by the denominator,  returning
   the  quotient and remainder. If the denominator is 0 the program  will
   terminate with an error message. The arguments and the returned values
   are all type long.

   Example
   #include <stdio.h>
   #include <stdlib.h>
   main()
   {
   long numer,denom;
   ldiv_t result;
        numer = 3;
        denom = 2;
        printf("The numerator is %ld and the denominator is"
                  "%ld\n", numer, denom);
        result = ldiv(numer,denom);
        printf("The quotient is %ld \n",result.quot);
        printf("The remainder is %ld \n",result.rem);
   }

   Return Value
   ldiv returns a structure of type ldiv_t, containing both quotient  and
   remainder.


See Also: div

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson