This Program will find the Quotient and remainder of any number we used div() function. The div() function exist in stdlib.h library. The complete signature of the function is div_t r (int a ,int b) where a is numerator and b is denominator.
Source Code
#include <stdlib.h> #include<iostream> using namespace std; int main () { div_t r; int number1,number2; cout<<" \t \t \t LEP Tutorials \n \n "; cout<<"Enter Number : "; cin>>number1; cout<<endl; cout<<" Enter Number : "; cin>>number2; r=div(number1,number2); cout<<endl; cout<<" The Quotient is :"<<(r.quot); cout<<endl<<endl; cout<<" The Remainder is :"<<(r.rem); cout<<endl<<endl; }
0 comments:
Post a Comment