0

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

2 Answers

+ 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

+ 1

Thanks my friend, i'll try it!