program to tell if a number is a perfect square

Solutions on MaxInterview for program to tell if a number is a perfect square by the best coders in the world

showing results for - "program to tell if a number is a perfect square"
Emanuele
29 Jan 2021
1import math
2
3# Taking the input from user
4number = int(input("Enter the Number"))
5
6root = math.sqrt(number)
7if int(root + 0.5) ** 2 == number:
8    print(number, "is a perfect square")
9else:
10    print(number, "is not a perfect square")