Quotient and remainder : Divide « Math « C / ANSI-C

Quotient and remainder

#include <stdlib.h>
#include <stdio.h>

int main(void)
  div_t n;

  n = div(10, 3);

  printf("Quotient and remainder: %d %d.\n", n.quot, n.rem);

  return 0;


Related examples in the same category

1.Quotient and remainder for long
2.Read int value and output the divide result
3. Divide two integer values: how to use div_t and div
4. Divide two long integer: how to use ldiv and ldiv_t