Looping problem:-
Input two positive integers a and b from the user. Determine the integer quotient of a/b. Assume that the division operator is not available.
#include <iostream>
int main()
{
int a; int b; int c; int count = 0;
std::cout << "Enter the number A: ";
std::cin >> a;
std::cout << "Enter the number B: ";
std::cin >> b;
c = a;
while (a > b)
{
a = a - b;
count = count + 1;
}
std::cout << "A/B: " << count;
}
Comments
Leave a comment