Array-promo

Question

Neon Number Between Given Range.
A neon number is a number where the sum of digits of the square of the number is equal to the number. For example, if the input number is 9, its square is 9*9 = 81 and the sum of the digits is 9. i.e. 9 is a neon number.
Note:-0,1,9 are the only Neon Numbers

Enter the lower range
0
Enter the Upper range
5000
Neon Numbers:0  1  9

Share code with your friends

Share on whatsapp
Share on facebook
Share on twitter
Share on telegram

Code

import java.util.*;
public class NeonNumber
{
    public static void main(String args[])
    {
        int upperRange=0,lowerRange=0,sum=0,squaredNumber=0,r=0,i=0;
        Scanner sc=new Scanner(System.in);
        System.out.println("Enter the lower range");
        lowerRange=sc.nextInt();
        System.out.println("Enter the Upper range");
        upperRange=sc.nextInt();
        System.out.print("Neon Numbers:");
        for(i=lowerRange;i<=upperRange;i++)
        {
            squaredNumber=i*i;
            sum=0;
            while(squaredNumber!=0)//Loop to find the sum of digits.
            {
                r=squaredNumber%10;
                sum=sum+r;
                squaredNumber=squaredNumber/10;
            }


            if(sum==i)
            {
                System.out.print(i+"  ");
            }

        }
    }

}

Coding Store

Sale

Original price was: ₹80.Current price is: ₹50.
Sale

Original price was: ₹250.Current price is: ₹150.
Sale

Original price was: ₹350.Current price is: ₹200.
Sale

Original price was: ₹80.Current price is: ₹50.
Sale

Original price was: ₹80.Current price is: ₹50.
Sale

Original price was: ₹80.Current price is: ₹50.
Sale
Mastering Array

Original price was: ₹80.Current price is: ₹50.
Sale

Original price was: ₹80.Current price is: ₹50.
Sale

Original price was: ₹80.Current price is: ₹50.
Sale

Original price was: ₹80.Current price is: ₹50.
Sale

Original price was: ₹250.Current price is: ₹150.
Sale

Original price was: ₹350.Current price is: ₹200.
Sale

Original price was: ₹80.Current price is: ₹50.
Sale

Original price was: ₹80.Current price is: ₹50.
Sale

Original price was: ₹80.Current price is: ₹50.
Sale
Mastering Array

Original price was: ₹80.Current price is: ₹50.
Sale

Original price was: ₹80.Current price is: ₹50.
Sale

Original price was: ₹80.Current price is: ₹50.
Sale

Original price was: ₹80.Current price is: ₹50.
Sale

Original price was: ₹250.Current price is: ₹150.
Sale

Original price was: ₹350.Current price is: ₹200.
Sale

Original price was: ₹80.Current price is: ₹50.
Sale

Original price was: ₹80.Current price is: ₹50.
Sale

Original price was: ₹80.Current price is: ₹50.
Sale
Mastering Array

Original price was: ₹80.Current price is: ₹50.
Sale

Original price was: ₹80.Current price is: ₹50.
Sale

Original price was: ₹80.Current price is: ₹50.

Leave a Reply

Your email address will not be published. Required fields are marked *