CBSE BOARD X, asked by mdperwezalam405, 9 months ago

WAP to check whether the no. Is neon or not

Answers

Answered by AbhijithPrakash
4

NEON NUMBER is a number whose sum of the digits of its square is equal to the original number.

For example, If the number entered by a user is 9, then the square of the number will be 81 and when we add both of the digits of 81 we get 9 which is equal to the original number that the user entered.

So, now we can make a program;

n = int(input("Enter any number : ")) ## We'll get the number from the user.

N = n**2 ## Then Square the number, in a different variable.

N=map(int, str(N)) ## This will convert the number into a list of digits.  

SumN=sum(N) ## Then we can add the numbers in the list.

##If the square is equal to the number, then it is Neon number, else it is not.

if n==SumN:

   print("{} is a Neon Number.".format(n))

else:

   print("{} is not a Neon Number".format(n))

Attachments:
Similar questions