div - returns the quotient and the remainder by using Structure in C


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

  int main(void)
  {
    div_t n;

    n = div(10, 3);

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

    return 0;
  }

Output:

Quotient:3
Remainder:1.