C/stdlib.h/div — различия между версиями

Материал из C\C++ эксперт
Перейти к: навигация, поиск
м (1 версия: Импорт контента...)
 
м (1 версия: Импорт контента...)
 
(нет различий)

Текущая версия на 10:23, 25 мая 2010

div: returns the quotient and the remainder in a structure of type div_t

    
//Declaration: div_t div(int numerator, int denominator); 

  #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;
  }
         
/*
Quotient and remainder: 3 1.
*/