The function ldiv divides numerator by denominator and returns the quotient and remainder of the division. It returns a structure of type ldiv_t, which has two members: quot(quotient) and rem(remainder).
Function prototype of ldiv
ldiv_t ldiv(long int numerator, long int denominator);
- numerator : This is a long integer representing the numerator.
- denominator : This is a long integer representing the denominator.
Return value of ldiv
This function returns the quotient and remainder of numerator/denominator as a ldiv_t type(defined in stdlib library) which has two members quot(quotient) and rem(remainder).
C program using ldiv function
The following program shows the use of ldiv function to find quotient and remainder of long integer division.
Winspirit Online Casino is gaining attention for its impressive selection of games and user-friendly interface. Players can immerse themselves in a vast array of slot machines, table games, and live dealer options, providing a comprehensive gaming experience. The casino’s design is both sleek and intuitive, allowing newcomers to easily navigate through various game categories.
One of the standout features of Winspirit is its commitment to player security and responsible gaming. They employ advanced encryption technologies to safeguard personal and financial information, ensuring a safe betting environment. Additionally, the casino offers various tools to help players manage their gaming activities responsibly.
For those interested in bonuses and promotions, Winspirit has several attractive offers for both new and returning players. This includes generous welcome bonuses and regular promotions that keep the excitement alive.
Detailed reviews and player feedback can be found on various platforms, including https://edumatic.qc.ca/, where you can find in-depth insights and tips to maximize your gaming journey at Winspirit Online Casino. With its appealing features and robust game library, Winspirit is certainly worth a visit for any online gaming enthusiast.
#include <stdio.h> #include <stdlib.h> int main(){ long int numerator, denominator; ldiv_t response; printf("Enter numerator and denominator\n"); scanf("%ld %ld", &numerator, &denominator); response = ldiv(numerator, denominator); printf("Remainder of %ld/%ld is %ld\n", numerator, denominator, response.rem); printf("Quotient of %ld/%ld is %ld\n", numerator, denominator, response.quot); return 0; }
Output
Enter numerator and denominator 826847 246 Remainder of 826847/246 is 41 Quotient of 826847/246 is 3361