English, asked by Anonymous, 9 months ago

write a program in bluej to input neon Number. please don't write if u don't know the answer​

Answers

Answered by jenishanto2004
3

Answer:

import java.util.Scanner;

public class NeonNumber  

{

public static void main(String[] args)

{

 int n,square,sum=0;

 //create object of scanner.

 Scanner sc = new Scanner(System.in);

 //you have to enter number here.

 System.out.print("Enter the number: " );

 n=sc.nextInt();

 //calculate square.

 square=n*n;

 while(square>0)

 {

  sum=sum+square%10;

  square=square/10;

 }

 //condition for checking sum is equal or not.

 if(sum==n)

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

 else

  System.out.println("Its not a Neon number.");

}

}

Explanation:

mark as brainliest

Answered by leuaxen
2

hey dear here is your answer....

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 and sum of the digits is 9. i.e. 9 is a neon number.

There are only 3 neon numbers. they are 0,1,9

import java.util.*;

public class NeonNumber

{

public static void main(String args[])

{

Scanner ob=new Scanner(System.in);

System.out.println("Enter the number to check neon number or not");

int num=ob.nextInt();

int square=num*num;

int sum=0;

while(square!=0)//Loop to find the sum of digits.

{

int a=square%10;

sum=sum+a;

square=square/10;

}

if(sum==num)

{

System.out.println(num+" is a Neon Number.");

}

else

{

System.out.println(num+" is not a Neon Number.");

}

}

}

hope it helps you dear....

thanks dear..

Similar questions