Java Program to check whether a number is a Neon or not. First of all, you need to know what are neon numbers.

**Neon No:** A number whose sum of digits of its square is equal to the given number is called neon no.

**Ex:** 9 (As square of 9 is 81 and 8+1=9)

## Algorithm to find Neon number

- First, we will calculate the square of the given no. and save it in a variable.
- Secondly, we will make a while loop which will add the digits of the squared no. The while loop is such that it operates till the squared number is greater than zero. It will add the remainder of the squared number in a sum variable initialized to zero. And decrement the while loop by dividing the squared number by 10.
- If the sum obtained is equaled to the given number, the number is a neon number else not.

Java program to check a Neon Number.

import java.util.Scanner; public class NeonNo { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int t=n*n; int sum=0; while(t>0) { sum=sum+t%10; t=t/10; } if(sum==n) System.out.println("Neon Number"); else System.out.println("Not a Neon number"); } }

**Input:** 9

**Output:** Neon Number

**Input:** 1

**Output:** Neon Number

**Input:** 0

**Output:** Neon Number

**Input:** 10

**Output:** Not a Neon Number

**Input:** 32

**Output:** Not a Neon Number