Neon Number Last Updated : 19 Jul, 2025 Comments Improve Suggest changes Like Article Like Report A neon number is a number where the sum of digits of square of the number is equal to the number. The task is to check and print neon numbers in a range. Examples: Input : 9Output : Neon NumberExplanation: square is 9*9 = 81 and sum of the digits of the square is 9.Input :12Output : Not a Neon NumberExplanation: square is 12*12 = 144 and sum of the digits of the square is 9 (1 + 4 + 4) which is not equal to 12.The implementation is simple, we first compute square of given number, the find sum of digits in the square. C++ // C/C++ program to check and print // Neon Numbers upto 10000 #include <iostream> using namespace std; #include <math.h> int checkNeon(int x) { // storing the square of x int sq = x * x; // calculating the sum of digits // of sq int sum_digits = 0; while (sq != 0) { sum_digits = sum_digits + sq % 10; sq = sq / 10; } return (sum_digits == x); } // Driver Code int main(void) { // Printing Neon Numbers upto 10000 for (int i = 1; i <= 10000; i++) if (checkNeon(i)) cout << i << " "; } Java // Java program to check and print // Neon Numbers upto 10000 import java.io.*; class GFG { // function to check Neon Number static boolean checkNeon(int x) { // storing the square of x int sq = x * x; // calculating the sum of digits // of sq int sum_digits = 0; while (sq != 0) { sum_digits = sum_digits + sq % 10; sq = sq / 10; } return (sum_digits == x); } // Driver Code public static void main(String args[]) throws IOException { // Printing Neon Numbers upto 10000 for (int i = 1; i <= 10000; i++) if (checkNeon(i)) System.out.print(i + " "); } } // This code is contributed by Nikita Tiwari. Python # Python program to check and print # Neon Numbers upto 10000 # function to check Neon Number def checkNeon (x) : # storing the square of x sq = x * x # calculating the sum of digits # of sq sum_digits = 0 while (sq != 0) : sum_digits = sum_digits + sq % 10 sq = sq / 10 return (sum_digits == x) # Driver Code i = 1 # Printing Neon Numbers upto 10000 while i <= 10000 : if (checkNeon(i)) : print i, i = i + 1 # This code is contributed by Nikita Tiwari. C# // C# program to check and print // Neon Numbers upto 10000 using System; class GFG { // function to check Neon Number static bool checkNeon(int x) { // storing the square of x int sq = x * x; // calculating the sum of digits // of sq int sum_digits = 0; while (sq != 0) { sum_digits = sum_digits + sq % 10; sq = sq / 10; } return (sum_digits == x); } // Driver Code public static void Main() { // Printing Neon Numbers upto 10000 for (int i = 1; i <= 10000; i++) if (checkNeon(i)) Console.Write(i + " "); } } // This code is contributed by vt_m. JavaScript <script> // Javascript program to check and print // Neon Numbers upto 10000 // function to check Neon Number function checkNeon(x) { // storing the square of x let sq = x * x; // calculating the sum of digits // of sq let sum_digits = 0; while (sq != 0) { sum_digits = sum_digits + sq % 10; sq = Math.floor(sq / 10); } return (sum_digits == x); } // driver program // Printing Neon Numbers upto 10000 for (let i = 1; i <= 10000; i++) if (checkNeon(i)) document.write(i + " "); </script> PHP <?php // PHP program to check and print // Neon Numbers upto 10000 function checkNeon($x) { // storing the square of x $sq = $x * $x; // calculating the // sum of digits of sq $sum_digits = 0; while ($sq != 0) { $sum_digits = $sum_digits + $sq % 10; $sq = $sq / 10; } return ($sum_digits == $x); } // Driver Code // Printing Neon Numbers // upto 10000 for ($i = 1; $i <= 10000; $i++) if (checkNeon($i)) echo $i . " "; // This code is contributed by Sam007 ?> Output: 1 9 Comment More infoAdvertise with us Next Article Javascript Program For Removing Duplicates From A Sorted Linked List N Nikita tiwari Improve Article Tags : Misc Mathematical DSA series Practice Tags : MathematicalMiscseries Similar Reads Javascript Program For Removing Duplicates From A Sorted Linked List Write a function that takes a list sorted in non-decreasing order and deletes any duplicate nodes from the list. The list should only be traversed once. For example if the linked list is 11->11->11->21->43->43->60 then removeDuplicates() should convert the list to 11->21->43- 8 min read Neon Element - Symbol, Electronic Configuration, Properties, Uses Neon is a chemical element with the symbol Ne and atomic number 10. It is a noble gas, colorless, and odorless under standard conditions. It was Discovered in 1898 by William Ramsay and Morris Travers that Neon is inert and does not form stable compounds. In this article, we will look into what Neon 5 min read Neon Text Display Using HTML & CSS In this article, you will learn to create a neon text display using HTML & CSS. The neon text display is the simplest yet one of the most striking effects used to give cool design to your texts on your web pages. In the neon display, the color of the text glows continuously which you can control 3 min read How to Build Animated Cursor Neon using HTML, CSS and JavaScript? The neon cursor moves with your mouse, creating a cool visual effect. You can change the neon color to match your website. You can also adjust how bright and wide the neon glow is to fit your style. You can transform your cursor into a bright neon trail. You can choose different colors, adjust the g 2 min read Java Program to Check If a Number is Neon Number or Not A neon number is a number where the sum of digits of the square of the number is equal to the number. The task is to check and print neon numbers in a range. Illustration: Case 1: Input : 9 Output : Given number 9 is Neon number Explanation : square of 9=9*9=81; sum of digit of square : 8+1=9(which 3 min read CÂ Program To Check Neon Number Given a number (num) we need to check whether it is a Neon Number ( i.e. a number where the sum of digits of the square of the number is equal to the number ) and return "true" or "false" accordingly. Example: Input: num = 9 Output: true Explanation: square of 9 is 9 * 9 = 81 , sum of digit of squar 3 min read Like