What is Neon Numbers ?

Last Updated on 25 Dec 2021 by Satya Prakash Singh Rathour
5 mins read

Neon Number :

 A number whose sum of digits of square of the number is equal to the number is called neon number. For example, number 9 is a neon number as its square is 81 and the sum of the digits is 9. i.e. 9 is a neon number.
 

#include <bits/stdc++.h>
using namespace std;
int main()
{
    int num, square, rem, sum = 0;
    cout << "Enter the number" << endl;
    cin >> num;
    square = num * num;
    while (square > 0)
    {
        rem = square % 10;
        sum = sum + rem;
        square = square / 10;
    }
    if (sum == num)
        cout << num << " is a Neon number" << endl;
    else
        cout << num << " is not a Neon number" << endl;
    return 0;
}

 

 

 
 
 
 
 

Category: Python | General Programming

Relavent Tags: Mathematics