write a program to input a number and check whether it is a Neon number or not
Answers
Answered by
11
hey mate ur answer is
⬇⬇⬇⬇⬇⬇⬇⬇⬇⬇
import java.util.Scanner;
public class NeonNumber {
public static void main(String[] args) {
int n,sq,sum = 0;
Scanner scan = new Scanner(System.in);
System.out.print("Enter a number:");
n = scan.nextInt();
sq = n * n; //find square of the n
//calculating the sum of square
while(sq > 0)
{
sum = sum + sq % 10;
sq = sq / 10;
}
if(sum == n) //check sum and number
System.out.println(n+" is a neon number.");
else
System.out.println(n+" is not a neon number.");
}
}
hope it help u
Anonymous:
9 is the neon number
Answered by
1
Java program to check whether the number is NEON NUMBER OR NOT...
Attachments:
Similar questions