Problem: Write a C program to check whether the number is Neon or not.

A number is called a Neon Number if the sum of digits of the square of the number is equal to the original number.

Example: 9

Neon Number Example

Steps to check neon number in C:

  1. Input a number.
  2. Calculate the square of the number.
  3. Sum digits of the square.
  4. Check whether the calculated sum is equal to the original number.
  5. If yes then the number is Neon, else it is not.

Here is the implementation of the steps in C:


Enter a number to check for neon number:
Neon Number

To sum up the digits of the square, we have individually extracted each digit using the Modulus operator (i.e. square%10) and added it to the sum variable.

In the end, we compared the calculated sum with the input number num to check whether the given number is a Neon number or not.

Leave a Reply

five × 3 =