write a program to check the number is neon or not.(java)
Answers
Explanation:
System. out. println("Enter the number to be checked."); int num=ob
Question:
Write a program to check the number is neon or not.(java).
Answer:
import java.util.*;
public class NeonNumber
{
public static void main(String[] args)
{
int n,s,sum=0;
Scanner in = new Scanner(System.in);
System.out.print("Enter the number: " );
n=in.nextInt();
s=n*n;
while(s>0)
{
sum=sum+s%10;
s=s/10;
}
if(sum==n)
System.out.println("Its a Neon number.");
else
System.out.println("Its not a Neon number.");
}
}
Explanation:
A neon is that in which the sum of the digits of the square of the number is equal to the number.
For example:
Let's say a number, 9.
The square of 9_
(9×9)
= 81
The sum of the digits of the square of 9_
(8+1)
= 9
Hence,
9=9.
∴ 9 is a neon number.
For more java programmings follow the given links as I have solved earlier:
brainly.in/question/14335606
brainly.in/question/14323927
brainly.in/question/14370842
brainly.in/question/14395545
brainly.in/question/14809512
brainly.in/question/14809885
brainly.in/question/14840551
brainly.in/question/15125968
brainly.in/question/15584326
brainly.in/question/15947017
https://brainly.in/question/16062696