Write a C++ program that inputs dividend and divisor. It then calculates and displays the quotient and remainder.


#include<iostream>

using namespace std;

int main()

{

int div,dis,q,r;

cout<<"Enter dividend & divisor :";

cin>>div>>dis;

q = div/dis;

r = div%dis;

cout<<"Quotient = "<<q<<endl;

cout<<"Remainder = "<<r;


}

OUTPUT

Enter dividend & divisor :20 3

Quotient = 6

Remainder = 2

No comments:

Post a Comment