First Perfect Square Given two integers (M and N), write a program to print the first perfect square in a given range.Input The first line of input will contain a positive integer (M). The second line of input will contain a positive integer (N).Output The output should be a single line containing the first perfect square in a given range.Explanation For example, if the given numbers are M is 4 and N is 16, the perfect squares from 4 to 16 are 4(2 * 2), 9(3 * 3), and 16(4 * 4), as the first perfect square is 4. So the output should be 4. Sample Input 1 4 16 Sample Output 1 4 Sample Input 2 5 8 Sample Output 2 No Perfect Square
1
Expert's answer
2021-10-30T13:32:39-0400
M = int(input())
N = int(input())
for i in range(M, N + 1):
if i ** 0.5 == int(i ** 0.5):
print("First Perfect Square:", i)
break
else:
print("No Perfect Square")
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
Finding a professional expert in "partial differential equations" in the advanced level is difficult.
You can find this expert in "Assignmentexpert.com" with confidence.
Exceptional experts! I appreciate your help. God bless you!
Comments
Leave a comment