Computer Science, asked by dtujb, 10 months ago

write a program in java to enter a number and check whether it is a neon number or not. ( a neon number is that in which the sum of the digits of its square is equal to the number. )​

Answers

Answered by AjayKumarr676
6

import java.util.*;

public class Neon

{

public static void main(String args[])

{

Scanner in = new Scanner(System.in);

int n,p, s=0,d;

System.out.println("Enter the number");

n=in.nextInt();

p=n*n;

do

{

d=p%10;

s=s+d;

p=p/10;

}

while(p!=0);

if(s==n)

System.out.println("Neon number");

else

System.out.println("Not a neon number");

}

}

Similar questions