lldiv() Return value
The lldiv() function returns a structure of type lldiv_t
which consists of two members: quot and rem. It is defined as follows:
struct lldiv_t { long long quot; long long rem; };
Example: How lldiv() function works in C++?
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
long long nume = 998102910012LL;
long long deno = 415LL;
lldiv_t result = lldiv(nume, deno);
cout << "Quotient of " << nume << "/" << deno << " = " << result.quot << endl;
cout << "Remainder of " << nume << "/" << deno << " = " << result.rem << endl;
return 0;
}
When you run the program, the output will be:
Quotient of 998102910012/415 = 2405067253 Remainder of 998102910012/415 = 17
Comments
Post a Comment