Articles

# Write a program to check if a number is neon number in python

In this python program guide, we will learn to write:

• NEON NUMBER PROGRAM IN PYTHON

### 🧐🧐What is a Neon Number?

A number is said to be a neon number if the sum of the digits of the square of the number is equal to that number.

Our task is to check whether an inputted number is neon or not in python.

For example

9 is a neon number because 9*9=81(8+1=9)

here sum of the digits of the square of the number is equal to that number.

Now lets try to write neon number program in python.

### 📙📙Neon number in python

Code for neon number program in python is given below:

``````# neon number program in python
while True:
x=int(input("enter a no :"))  # for user input
if(x==0):
print("the program has been terminated")
break  # to terminate the program
p=x**2
sum=0
while (p!=0):
rem=p%10
sum=sum+rem  # to store the sum of digits of the square of the number
p=p//10
if(sum==x):
print("inputted no is neon")
else :
print("inputted no is not neon number ")``````

👉👉The program will check whether the inputted no is neon number in python or not untill the user enters 0 as a number.When user inputs 0 as a number the program will be terminated.

### 🤷‍♀️🤷‍♀️🤷‍♀️Output to the neon number in python is given below:

``````enter a no :6
inputted no is not neon number
enter a no :7
inputted no is not neon number
enter a no :9
inputted no is neon
enter a no :0 the program has been terminated``````

Screenshot of running  program in jupyter notebook: As you can see in the screenshot the neon number program in python is running successfully.

Basic Python Programs
Python Conversion Programs

Would you like to see your article here on tutorialsinhand. Join Write4Us program by tutorialsinhand.com 