Neon Number is a number whose sum of digits of it’s square is equal to the original number.
Example 1: 9. 92 = 81. 8+1=9. We observe that the sum of digits of the square of original number is equal to the original number. Hence it is a Neon Number.
Example 2: 11. 112 = 121. 1+2+1 = 4. Here the sum of digits of the square of original number is not equal to the original number. Hence it is not a Neon Number.
Java
import java.util.*;
public class NeonNumber
{
public static void main(String args[])
{
int n=0,r=0,s=0,temp=0;
Scanner sc=new Scanner(System.in);
System.out.print("Enter a number: ");
n=sc.nextInt();
temp=n*n;
while(temp>0)
{
r=temp%10;
s=s+r;
temp=temp/10;
}
if(s==n)
{
System.out.println(n+" is a Neon Number");
}
else
{
System.out.println(n+" is not a Neon Number");
}
}
}Java