In this video, we will write C program to check the neon number.
What is a Neon number?
A number is said to be a neon number, if and only if the sum of digits of the square of the number is equal to the same number.
For examples:
=> Square of 9 = 92 = 81
=> Sum of the digits of the square = 8+1= 9
=> So, 9 is a Neon Number
=>Square of 6 = 62 = 36
=>Sum of the digits of the square = 3+6 = 9
=> Here, 6 is not equal to 9.
=> So, 6 is not a Neon Number.
Algorithm:
- Step 1: First, we find the square of the given number.
- Step 2: In the second step, find the sum of the digit of the square by using a loop.
- Step 3:The condition checksum is equal to the given number.
- Step 3.1Print” true, the number is neon number”.
Else - Step 3.2 Print ”False, the number is not neon number”.
Here in this video, we will see 3 various approaches for checking whether a number is a neon number or not:
- Using while loop
- Using recursive method
- Using string function with for loop
C Program to check neon number: https://www.geeksforgeeks.org/c-program-to-check-neon-number/