Answer to Question #292901 in Python for gayi3

Question #292901

you are given two given numbers, A and B where 1<= A <=B, write a program to find the number of perfect squares in range A to B (including A and B).


1
Expert's answer
2022-02-02T12:50:00-0500
A= int(input("Enter the Lower bound: "))
B=int(input("Enter the Upper bound: "))
j=1
for i in range(A, B+1):
  while(j<=((i//2)+1)):
    if(j**2==i):
      print(i)
    j+=1
  j=1

Output :

Enter the Lower bound: 4
Enter the upper bound: 56
4
9
16
25
36
49 

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