C++ STL में lldiv() फंक्शन दो संख्याओं के विभाजन के भागफल और शेष का परिणाम देता है।
एल्गोरिदम
Begin
दो लॉन्ग टाइप नंबर इनपुट के रूप में लें।
lldiv() फंक्शन कॉल करें।
भागफल और शेष प्रिंट करें।
End.
उदाहरण कोड
#include <cstdlib>
#include <iostream>
using namespace std;
int main() {
long long q = 500LL;
long long r = 25LL;
lldiv_t res = lldiv(q, r);
cout << "Quotient of " << q << "/" << r << " = " << res.quot << endl;
cout << "Remainder of " << r << "/" << r << " = " << res.rem << endl;
return 0;
}
आउटपुट
Quotient of 500/25 = 20
Remainder of 25/25 = 0