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 convert int number to hexadecimal number in C#

2 Answers

0 votes
using System;

namespace ConsoleApplication_C_Sharp
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = 98213;

            Console.WriteLine("{0:x}", n);
            Console.WriteLine("{0:x}", n);

            Console.WriteLine();

            Console.WriteLine("{0:X}", n);
            Console.WriteLine("{0:X}", n);

            Console.WriteLine();

            Console.WriteLine("{0:X6}", n);
            Console.WriteLine("{0:X8}", n);
        }
    }
}


/*
run:
     
17fa5
17fa5

17FA5
17FA5

017FA5
00017FA5

*/

 



answered Dec 23, 2016 by avibootz
0 votes
using System;

namespace ConsoleApplication_C_Sharp
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = 98213;

            string hex = n.ToString("X6");

            Console.WriteLine(hex);
        }
    }
}


/*
run:
     
017FA5

*/

 



answered Dec 23, 2016 by avibootz

Related questions

1 answer 152 views
1 answer 119 views
1 answer 113 views
1 answer 172 views
2 answers 260 views
...