C++ Program to find quotient without using division operator


In this program, You will learn how to find quotient without using division operator in C++.


2 = 10 / 5

0 = 5 / 10


Example: How to find quotient without using division operator in C++

Run it Now
#include<iostream>
using namespace std;

int main() {

  int a, b, c = 0;
  cout << "Enter First Number :";
  cin >> a;
  cout << "\nEnter Second Number :";
  cin>>b;

  while (a >= b) {
      a = a - b;
      c++;
  }
  cout << "\nQuotient is :" << c;

  return 0;
}

Output:

Enter First Number :8
Enter Second Number :4
Quotient is :2