C/C++ লাইব্রেরি ফাংশন div_t div(int numer, int denom) numer(numerator) কে denom (হর) দ্বারা ভাগ করে। নিচে div()ফাংশনের জন্য ঘোষণা করা হল।
div_t div(int numer, int denom)
পরামিতি হল লব এবং হর। এই ফাংশনটি
উদাহরণ
#include <iostream>
#include <cstdlib>
using namespace std;
int main () {
div_t output;
output = div(27, 4);
cout << "Quotient part of (27/ 4) = " << output.quot << endl;
cout << "Remainder part of (27/4) = " << output.rem << endl;
output = div(27, 3);
cout << "Quotient part of (27/ 3) = " << output.quot << endl;
cout << "Remainder part of (27/3) = " << output.rem << endl;
return(0);
} আউটপুট
Quotient part of (27/ 4) = 6 Remainder part of (27/4) = 3 Quotient part of (27/ 3) = 9 Remainder part of (27/3) = 0