Neon Number is that number whose sum of digits of its square is equal to the original number. For e.g 9
Steps to check Neon number in C
- Take a number as input.
- Square the number.
- Extract the square’s digits and add all of them.
- Check if the sum of digits of square is equal to original number or not.
- If yes then the number is Neon, else it is not.

Neon Number in C
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
#include <stdio.h> #include <stdlib.h> int main() { int n, digit, sum =0; printf("Enter a number to check for neon Number \n"); scanf("%d",&n); int sq = n*n; while(sq!=0){ digit = sq % 10; sum += digit; sq = sq/10; } if(sum == n) printf("Neon Number \n"); else printf("Not a Neon Number \n"); return 0; } |


If you have any confusion regarding program code then comment below.