Function name : ldiv
Header file : <stdlib.h>
Function prototype : ldiv_t ldiv(long lx,long ly);
Function : used to divide two long integer numbers
Parameter : long lx is the dividend
long ly is the divisor
Return value : Returns the quotient and remainder
Supplement : typedef struct{
long quot;
long rem;
}ldiv_t;
Program example : Use this function to calculate the quotient and remainder of the division of two long integer numbers 165000 and 35500.
#include<stdio.h>#include<stdlib.h>intmain(void){ldiv_tlx=ldiv(165000L,35500L);printf(165000div35500=%ldremainder%ldn,lx.quot,lx.rem);return0; }
Running results
165000div35500=4remainder23000