Integer type (typically 4 bytes, -2,147,483,648 to 2,147,483,647)
1st Parameter
The numerator (dividend) of the division
2nd Parameter Type : int
Integer type (typically 4 bytes, -2,147,483,648 to 2,147,483,647)
2nd Parameter
The denominator (divisor) of the division
Read more about parameters of div in parameters section
The divfunction in C language Divides two integers and returns both the quotient and remainder.
The div function computes the quotient and remainder of the division of the numerator numer by the denominator denom. This function is useful when you need both the quotient and remainder of an integer division operation. The result is returned in a structure of type div_t, which contains two int members: quot (the quotient) and rem (the remainder).
The divfunction takes 2
parameters:
•
int `numer`: The numerator (dividend) of the division
•
int `denom`: The denominator (divisor) of the division
Performs integer division of `numer` by `denom` and returns the result as a `div_t` structure, which contains both the quotient and the remainder.
The div function return value :
Returns a structure of type div_t that contains two int members: quot (the quotient) and rem (the remainder)
Output
This example demonstrates the basic usage of the `div` function. It divides 17 by 5 and shows both the quotient and remainder.