How to convert a number to base 24 and convert it back?

1.3k views Asked by At

How can I convert a number to a base-24 string? And how can I convert this string back to a number?

e.g.: 25 in base-10 is 11 in base-24, 2B in base-24 is 48+11 = 59 in base-10

1

There are 1 answers

0
Ashokreddy On

This code is working fine both decimal to hex and hex to decimal

        var HexVal = "2B";
        int DecimalVal = Convert.ToInt32(HexVal, 16);
        Console.WriteLine(DecimalVal);
        string HexVal1 = DecimalVal.ToString("X");
        Console.WriteLine(HexVal1);