Div () function in C
Div_t div function (int numer, int denom) divides numer numerator for denom.
Div () function in C
Div_t div function (int numer, int denom) divides numer numerator for denom .
Declare the div () function in C
Below is the declaration for div () in C:
div_t div ( int numer , int denom )
Parameters
numer : numerator.
denom : denominator.
Returns the value
This function returns the value in an internal, two-part structure, with div_t it is: int quot; int rem;
For example
The following C program illustrates the usage of div () in C:
#include #include int main () { div_t output ; output = div ( 27 , 4 ); printf ( "Phan thuong cua phep chia (27/ 4) = %dn" , output . quot ); printf ( "Phan du cua phep chia (27/4) = %dn" , output . rem ); output = div ( 27 , 3 ); printf ( "nPhan thuong cua phep chia (27/ 3) = %dn" , output . quot ); printf ( "Phan du cua phep chia (27/3) = %dn" , output . rem ); return ( 0 ); }
Compiling and running the above C program will result:
According to Tutorialspoint
Previous lesson: Function abs () in C
Next lesson: Labs () function in C
4 ★ | 2 Vote
You should read it
- Call the function by pointer in C ++
- Function realloc () in C
- Malloc () function in C
- Function abs () in C
- The function getenv () in C
- The function rand () in C
- The abort () function in C
- Pass cursor to function in C ++
- Cursor this in C ++
- Labs () function in C
- The function ldiv () in C
- The qsort () function in C
Maybe you are interested
Qualcomm considers buying part of Intel's chip design division
Close-up of a diver's encounter with anaconda and piranha in the Brazilian river
How to download and use VMware Workstation Pro for free for individual users
A steppe kestrel kills a mallard with a 'shadowless' dive at a speed of 90km/h
How to divide a hard drive on Windows 10 is extremely easy, anyone can do it
Individual investors are no longer 'enthusiastic' about Bitcoin's recent price increase