V
V
Vlad_Radigin2018-07-19 16:16:07
Java
Vlad_Radigin, 2018-07-19 16:16:07

How in java to find out how many times it is possible to subtract a smaller number from a large number?

For example, through Scanner, request two numbers, a and b
a = 5, b = 1;
How in java can you find out how many times from a large number, you can subtract a smaller one? in this example, the answer will be five times, but how to check this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Valitov, 2018-07-19
@Andrvat

1. Completely divide a by b (bring to integer type).
2. Create a counter and subtract the smaller one from the larger one, as long as possible.
The answer will be in the counter.
With such questions, you will find the answer faster in Google than here.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question