Question #98764

write a c++ program that asks the user to enter two numbers: a dividend and a divisor. it the calculates the quotient and the remainder. loop the program to infinity.

Expert's answer

#include <iostream>

using namespace std;

int main()
{
  int dividend, divisor, quotient, remainder;
  while(1)
  {
    cout << "\tPlease, enter dividend and divisor!" << endl << "Dividend : ";
    cin >> dividend;
    cout << "Divisor : ";
    cin >> divisor;
    quotient = dividend/divisor;
    remainder = dividend%divisor;
    cout << "Quotient = " << quotient << "\tRemainder = " << remainder << endl;
  }
}
LATEST TUTORIALS
APPROVED BY CLIENTS