Exercise 14 

Write a program in Python language that asks the user to enter an integer n and display it if this number is perfect square or not

Solution

# Ask to type a value of the integers n
n = int(input("Type a value of the integer n : "))
# we can use a compteur j
j = 0
for i in range(0,n):
if(i**2 == n):
j = j +1
if(j > 0):
print("The nteger ", n , " is a perfect square")
else:
print("The nteger ", n , " is not a perfect square")
my-courses.net
One thought on “Solution Exercise 14”

Leave a Reply