Code is copied!
Program To Print Neon Number JAVA
Write a Program to print whether the inputted number is Neon or not.
[A neon number is a number where the sum of digits of square of the number is equal to the number. For example if the input number is 9, its square is 9*9 = 81 , sum of its digits = 1 + 8 = 9]
import java.util.*;
class neon
{
public static void main(String args[])
{
Scanner sc = new Scanner (System.in);
int n = sc.nextInt();
int sq = n * n,sum =0;
while (sq!=0)
{
sum = sum + (sq%10);
sq=sq/10;
}
if(sum == n)
{
System.out.println("yes it is neon number");
}
else
{
System.out.println("No it is not neon");
}
}
}