C++ Program to find quotient without using the 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++.
#include<iostream>
using namespace std;
int main() {
int a, b, c = 0;
cout << "Enter first number:";
cin >> a;
cout << "Enter second number:";
cin>>b;
while (a >= b) {
a = a - b;
c++;
}
cout << "Quotient is:" << c;
return 0;
}
Output:
Enter first number:12
Enter second number:3
Quotient is:4