How to find number of squares between two numbers?
Answers
Answered by
0
Answer:
We take floor of sqrt(b) because we need to consider
numbers before b.
We take ceil of sqrt(a) because we need to consider
numbers after a.
For example, let b = 24, a = 8. floor(sqrt(b)) = 4,
ceil(sqrt(a)) = 3. And number of squares is 4 - 3 + 1
= 2. The two numbers are 9 and 16.
Similar questions