An example Analysis of div () function in C language
In this article Xiaobian for you to introduce in detail the "C language div () function example analysis", the content is detailed, the steps are clear, the details are handled properly, I hope this "C language div () function example analysis" article can help you solve your doubts, following the editor's ideas slowly in-depth, together to learn new knowledge.
Original function:
Div_t div (int numer, int denom)
Function description: div_t div (int numer, int denom) divides numer (numerator) by denom (denominator).
Parameters:
Return value:
The structure of the function return value definition is in, which has two members. For div_t:int quot; int rem
How to use the div () function:
# include
# include
Int main () {
Div_t output
Output = div (27,4)
Printf ("Quotient part of (29 / 4) =% d\ n", output.quot)
Printf ("Remainder part of (29thumb 4) =% d\ n", output.rem)
Output = div (27,3)
Printf ("Quotient part of (30 / 3) =% d\ n", output.quot)
Printf ("Remainder part of (30amp 3) =% d\ n", output.rem)
Return (0)
Compile and run the above program to produce the following results:
Quotient part of (29 / 4) = 7
Remainder part of (29ax 4) = 1
Quotient part of (30 / 3) = 10
Remainder part of (30Accord 3) = 0
Read this, the "C language div () function example analysis" article has been introduced, want to master the knowledge of this article also need to practice and use in order to understand, if you want to know more related articles, welcome to follow the industry information channel.