How to convert decimal to hexadecimal in C#

1 Answer

0 votes
using System;

class Program
{
    static void Main() {
        int dec = 253;
        
        string hex = dec.ToString("X");

        Console.Write(hex);
    }
}



 
 
/*
run:
 
FD
 
*/

 



answered Aug 25, 2021 by avibootz

Related questions

1 answer 150 views
150 views asked Aug 25, 2021 by avibootz
1 answer 93 views
1 answer 102 views
1 answer 97 views
1 answer 97 views
1 answer 103 views
103 views asked Feb 14, 2025 by avibootz
2 answers 127 views
...