Thursday, October 24, 2013

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

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#
convert decimal hexadecimal 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 integer hexadecimal c#
convert decimal hexadecimal java
convert decimal binary c#
c# convert decimal ascii
c# to hex
IT Certification Category (English)640x480

Partner Sites

VideoToGifs.com

EasyOnlineConverter.com

SqliteTutorials.com


Top Online Courses From ProgrammingKnowledge

Python Course http://bit.ly/2vsuMaS
Java Coursehttp://bit.ly/2GEfQMf
Bash Coursehttp://bit.ly/2DBVF0C
Linux Coursehttp://bit.ly/2IXuil0
C Course http://bit.ly/2GQCiD1
C++ Coursehttp://bit.ly/2V4oEVJ
PHP Coursehttp://bit.ly/2XP71WH
Android Coursehttp://bit.ly/2UHih5H
C# Coursehttp://bit.ly/2Vr7HEl
JavaFx Coursehttp://bit.ly/2XMvZWA
NodeJs Coursehttp://bit.ly/2GPg7gA
Jenkins Course http://bit.ly/2Wd4l4W
Scala Coursehttp://bit.ly/2PysyA4
Bootstrap Coursehttp://bit.ly/2DFQ2yC
MongoDB Coursehttp://bit.ly/2LaCJfP
QT C++ GUI Coursehttp://bit.ly/2vwqHSZ