Program that inputs dividend and divisor. It then calculates and displays the quotient and remainder.
Topic:
Standard Input
Problem:
Write a program that inputs dividend and divisor. It then calculates and displays the quotient and remainder.
Solution:
#include<iostream.h>
#include<conio.h>
int main ()
{
int divd, divs, q, r;
cout<<"enter dividend & divisor:";
cin>>divd>>divs;
q=divd/divs;
r=divd%divs;
cout<<endl<<"quotient is:"<<q;
cout<<endl<<"remainder is:"<<r;
getch();
}
#include<conio.h>
int main ()
{
int divd, divs, q, r;
cout<<"enter dividend & divisor:";
cin>>divd>>divs;
q=divd/divs;
r=divd%divs;
cout<<endl<<"quotient is:"<<q;
cout<<endl<<"remainder is:"<<r;
getch();
}
Output:
Let me know in the comment section if you have any question.
Previous Post:
Next Post: