home *** CD-ROM | disk | FTP | other *** search
/ PC Extra Super CD 1998 January / PCPLUS131.iso / DJGPP / V2 / DJLSR201.ZIP / src / libc / ansi / stdlib / div.txh < prev    next >
Encoding:
Text File  |  1995-07-10  |  690 b   |  39 lines

  1. @node div, math
  2. @subheading Syntax
  3.  
  4. @example
  5. #include <stdlib.h>
  6.  
  7. div_t div(int numberator, int denomonator);
  8. @end example
  9.  
  10. @subheading Description
  11.  
  12. Returns the quotient and remainder of the division @var{numberator}
  13. divided by @var{denomonator}.  The return type is as follows:
  14.  
  15. @example
  16. typedef struct @{
  17.   int quot;
  18.   int rem;
  19. @} div_t;
  20. @end example
  21.  
  22. @subheading Return Value
  23.  
  24. The results of the division are returned.
  25.  
  26. @subheading Example
  27.  
  28. @example
  29. div_t d = div(42, 3);
  30. printf("42 = %d x 3 + %d\n", d.quot, d.rem);
  31.  
  32. div(+40, +3) = @{ +13, +1 @}
  33. div(+40, -3) = @{ -13, -1 @}
  34. div(-40, +3) = @{ -13, -1 @}
  35. div(-40, -3) = @{ +13, -1 @}
  36.  
  37. @end example
  38.  
  39.