Unlocking the Logic Behind Neon, Strong & Perfect Numbers
1. Neon Number A Neon Number is a number where: Sum of digits of its square = the number itself Example: Number = 9 Square = 81 Sum = 8 + 1 = 9 So, 9 is a Neon Number. Key Logic: Find square of num...

Source: DEV Community
1. Neon Number A Neon Number is a number where: Sum of digits of its square = the number itself Example: Number = 9 Square = 81 Sum = 8 + 1 = 9 So, 9 is a Neon Number. Key Logic: Find square of number Extract digits Add digits Compare with original number Python def neon_no(no): sqr = no * no res = sqr sum = 0 while res > 0: sum = sum + res % 10 res = res // 10 if sum == no: print("Neon") else: print("Not Neon") neon_no(9) JavaScript function neonNo(no) { let sqr = no * no; let res = sqr; let sum = 0; while (res > 0) { sum = sum + (res % 10); res = Math.floor(res / 10); } if (sum === no) { console.log("Neon"); } else { console.log("Not Neon"); } } neonNo(9); Java public class Main { public static void neonNo(int no) { int sqr = no * no; int res = sqr; int sum = 0; while (res > 0) { sum = sum + (res % 10); res = res / 10; } if (sum == no) { System.out.println("Neon"); } else { System.out.println("Not Neon"); } } public static void main(String[] args) { neonNo(9); } } Output 2.