DEV Community

hema latha
hema latha

Posted on

Neon number

A positive integer whose sum of digits of its square is equal to the number itself is called a neon number.

Image description

0-100000 Neon numbers = 0,1,9

package day1;

public class Neon_number {

public static void main(String[] args) {
    // TODO Auto-generated method stub
Enter fullscreen mode Exit fullscreen mode

int no = 9;
int square = no*no;
System.out.println(square);
int result = sum_of_digits(square);
System.out.println(result);
if (result==no)
System.out.println("neon");
else
System.out.println("Not Neon");

}

private static int sum_of_digits(int square) {
    // TODO Auto-generated method stub

    int sum = 0;
    while(square>0)
    {
        sum = sum+square%10;
        square = square/10;
    }
    return sum;



}
Enter fullscreen mode Exit fullscreen mode

}

out put=
81
9
neon

Top comments (0)

Image of Checkly

Replace beforeEach/afterEach with Automatic Fixtures in Playwright

  • Avoid repetitive setup/teardown in spec file
  • Use Playwright automatic fixtures for true global hooks
  • Monitor JS exceptions with a custom exceptionLogger fixture
  • Keep your test code clean, DRY, and production-grade

Watch video

👋 Kindness is contagious

Engage with a wealth of insights in this thoughtful article, valued within the supportive DEV Community. Coders of every background are welcome to join in and add to our collective wisdom.

A sincere "thank you" often brightens someone’s day. Share your gratitude in the comments below!

On DEV, the act of sharing knowledge eases our journey and fortifies our community ties. Found value in this? A quick thank you to the author can make a significant impact.

Okay