Number of perfect squares between 1 and 1000 in python
Answers
Answered by
0
Answer:
30
Step-by-step explanation:
def CountSquares(a, b):
cnt = 0 # initialize result
# Traverse through all numbers
for i in range (a, b + 1):
j = 1;
while j * j <= i:
if j * j == i:
cnt = cnt + 1
j = j + 1
i = i + 1
return cnt
Similar questions