Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

program to tell if a number is a perfect square

import math

# Taking the input from user
number = int(input("Enter the Number"))

root = math.sqrt(number)
if int(root + 0.5) ** 2 == number:
    print(number, "is a perfect square")
else:
    print(number, "is not a perfect square")
Source by djangocentral.com #
 
PREVIOUS NEXT
Tagged: #program #number #perfect #square
ADD COMMENT
Topic
Name
4+7 =