## How to convert decimal to Binary, Octal, Hex conversion in C#

```Random rand = new Random();
int value = rand.Next(0, 1001);
String binaryRepresentation = Convert.ToString(value, 2);
String octalRepresentation = Convert.ToString(value, 8);
String base10Representation = Convert.ToString(value);
String hexRepresentation = Convert.ToString(value, 16);
// Any other bases and you are on your own.

// Go the other way.
int binary = Convert.ToInt32(binaryRepresentation, 2);
int octal = Convert.ToInt32(octalRepresentation, 8);
int base10 = Convert.ToInt32(base10Representation);
int hex = int.Parse(hexRepresentation, System.Globalization.NumberStyles.HexNumber); ```
```// alternative
Console.WriteLine("Binary: " + binaryRepresentation + " = " + binary.ToString());
Console.WriteLine("Octal: " + octalRepresentation + " = " + octal.ToString());
Console.WriteLine("Base10: " + base10Representation + " = " + base10.ToString());
Console.WriteLine("Hex: " + hexRepresentation + " = " + hex.ToString());```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
`--------------------------------------------`
```
Decimal To Octal C# Searches related to program to Convert Decimal to binary c#
convert decimal binary java
convert decimal binary visual basic
convert integer binary c#
c# convert decimal ascii
int to binary c#
Convert Decimal To Octal In C#
Converting Decimal To Octal C sharp
c# - Decimal to binary conversion in c #
Write a Program to convert Decimal to Binary in C#.NET
How convert decimal to binary
Converting decimal number into Octal number
C#: Decimal to Binary Conversion
Convert Decimal Number to Octal Number
How to convert numbers between hexadecimal and decimal in C#
Convert Type Decimal to Hex
C Sharp Code
Searches related to program to convert decimal to hexadecimal in c#
c# convert hex string to decimal
convert decimal binary c#
c# convert decimal ascii
c# to hex```

# Partner Sites

## SqliteTutorials.com

### Stuff I use to make videos

Apple MacBook Pro - http://amzn.to/2AC0WG2

Ubuntu notebook - https://amzn.to/2GE4giY

Desktop - http://amzn.to/2zct252

Microphone - http://amzn.to/2AC1kV0

notebook mouse - http://amzn.to/2BmeZ2d

### Online Courses to learn

Java - https://bit.ly/2H6wqXk

AngularJS - https://bit.ly/2qebsLu

Python- https://bit.ly/2Eq0VSt

Android - https://bit.ly/2qaRSAS

Linux - https://bit.ly/2IwOuqz

AWS Certified Solutions Architect - https://bit.ly/2JrGoAF

Modern React with Redux- https://bit.ly/2H6wDtA

MySQL - https://bit.ly/2qcF63Z