In this python program, we are given a number and we have to
check whether the number is neon or not.
Neon Number is a number whose sum of digits of its square is equal to the original number.
Steps to Check Neon Number in Python
- Take a number as input.
- Find Square of the number.
- Calculate the sum of digits of the square.
- If the square is equal to the number, then it is neon number, else not.
Neon Number in Python
num = int(input("Enter a number \n"))
sqr = num*num #square of num
sumOfDigit = 0
#calculating sum of digits of sqr
while sqr>0:
sumOfDigit =sumOfDigit + sqr%10
sqr = sqr//10
if (num == sumOfDigit):
print("Neon Number \n")
else:
print("Not a Neon Number \n")
Language: Python 3
Output

That's all we need to do, in order to check whether a number is neon or not in python 3. If you have any doubts then comment below.