Divide two integer values: how to use div_t and div : Divide « Math « C / ANSI-C






Divide two integer values: how to use div_t and div



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

int main ()
{
  div_t divresult;
  
  divresult = div (28, 5);
  
  printf ("28 / 5 = %d ( %d", divresult.quot, divresult.rem);
  return 0;
}

           
       








Related examples in the same category

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