Skip to content
Dev.to1 min read

Unlocking the Logic Behind Neon, Strong & Perfect...

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 su
Read original on dev.to
0
0

Comment

Sign in to join the discussion.

Loading comments…

Related

Get the 10 best reads every Sunday

Curated by AI, voted by readers. Free forever.

Liked this? Start your own feed.

0
0