Convert Decimal Number to Binary,Octal and C# with Example



Convert Decimal Number to Binary,Octal and C# with Example

Hexadecimal Format 
1. To convert decimal number to binary format use base 2 
Int32 Number = 15; 
Console.WriteLine(Convert.ToString(Number, 2)); //OUTPUT : 1111 
2. To convert decimal number to octal format use base 8 
int Number = 15; 
Console.WriteLine(Convert.ToString(Number, 8)); //OUTPUT : 17 
3. To convert decimal number to hexadecimal format use base 16 
var Number = 15; 
Console.WriteLine(Convert.ToString(Number, 16)); //OUTPUT : f 

0 Comment's

Comment Form

Submit Comment