Java program to check neon number code example
Example: Java program to check neon number
import java.util.Scanner;
public class NeonNumberInJava
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
System.out.println("Please enter number to check neon number or not: ");
int number = sc.nextInt();
int square = number * number;
int sum = 0;
while(square != 0)
{
int n = square % 10;
sum = sum + n;
square = square / 10;
}
if(sum == number)
{
System.out.println(number + " is a neon number.");
}
else
{
System.out.println(number + " is not a neon number.");
}
sc.close();
}
}