# Neon Number in Java

In this section, we will discuss what is the neon numbers and also create a Java program to check if the given number is neon or not. Also, we will find all the neon numbers between a specified range.

## Neon Number

A positive integer whose sum of digits of its square is equal to the number itself is called a neon number.

### Example of Neon Number

Let's take an example and check 9 and 45 are neon numbers or not. ## Steps to Find Neon Number

1. Read an integer from the user or initialize a number (n) to check.
2. Calculate the square of the given number (n) and store it in variable sq.
3. Find the sum of the digits of the square (sq) and store the sum in the variable (sum).
4. Compare the given number n with If both are equal, the given number is a neon number, else, not a neon number.

Let's implement the above steps in a Java program.

## Neon Number Java Program

The logic is very simple. First, we have to calculate the square of the given number. After that, calculate the sum of digits in the square.

Let's create a Java program that checks if the given number is neon or not.

NeonNumberExample1.java

Output:

```Enter the number to check: 9
9 is a Neon Number.
```

Let's find all the neon numbers between a specified range.

NeonNumberExample2.java

Output:

```Neon Numbers between the given range are: 0 1 9
```

We get only three neon numbers between 0 to 100000. So, there is a probability that 1 Trillion also includes 0, 1, 9 as the neon numbers.

Next TopicSpy Number in Java

### Feedback   