0

How to convert implicitly a number from decimal to binary or from decimal to octal or hexadecimal in C Sharp with visual studio

18th Dec 2018, 8:47 PM
Owan
Owan - avatar
2 Antworten
+ 4
This will convert an integer into its string equivalent in the certain radix (base) but this is only for integer, when you say decimal, did you mean floating points number (real) or what? int i = 1024; // binary (base 2) Console.WriteLine(Convert.ToString(i, 2)); // octal (base 8) Console.WriteLine(Convert.ToString(i, 8)); // hexadecimal (base 16) Console.WriteLine(Convert.ToString(i, 16)); Looking forward from others ... Hth, cmiiw
21st Dec 2018, 8:22 AM
Ipang
+ 1
Thanks my friend, i'll try it!
21st Dec 2018, 7:06 PM
Owan
Owan - avatar