Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

40,026 questions

51,982 answers

573 users

How to check if a number is neon number in C#

1 Answer

0 votes
// Neon Number is a number whose sum of digits of its square is equal to the original number
// 9 : 9 * 9 = 81 : 8 + 1 = 9 : 9 is a neon number

using System;

class Program
{
    static void Main() {
        int num = 9;
        int sqr = num * num; 
        int sumOfDigit = 0;
  
        while (sqr > 0) {
            sumOfDigit += sqr % 10;
            sqr /= 10;
        }
         
        if (num == sumOfDigit)
            Console.Write("Neon Number");
        else
            Console.Write("Not a Neon Number");
    }
}




/*
run:
 
Neon Number
 
*/

 



answered Oct 23, 2021 by avibootz

Related questions

1 answer 138 views
1 answer 111 views
111 views asked Oct 26, 2021 by avibootz
1 answer 145 views
1 answer 100 views
1 answer 182 views
1 answer 180 views
1 answer 89 views
...