Perfect Squares in a Range
Submissions: 2029   Accuracy:

56.72%

  Difficulty: Basic   Marks: 1

Given two given numbers a and b where 1<=a<=b, find the number of perfect squares between a and b (a and b inclusive).

Input:
First line of input contains number of test cases T. Each line of test case contain numbers 'a' and 'b' seperated by a single space.

Output:
Number of perfect squares are displayed.

Constraints:
1 <= T <= 100
1 <= a,b <= 105 
Example:
Input:

2
9 25
1 1000

Output:
3
31

** For More Input/Output Examples Use 'Expected Output' option **

Author: atharv


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.

to report an issue on this page.