Answer to Question #345281 in C++ for Ali

Question #345281

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.


1
Expert's answer
2022-05-30T08:15:16-0400
#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;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS