TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Maha
NA
0
328.1k
Converting
Oct 23 2013 5:21 AM
When Converting decimal to binary or binary to decimal following function has been used.
binaryNum = Convert.ToString(decimalNum, 2);
i = Convert.ToInt32(binaryString, 2);
I wish to know what is 2 means. Problem is highlighted below.
using System;
namespace Converting_decimal_binary
{
class Program
{
static void Main(string[] args)
{
//Converting decimal to binary
int decimalNum = 20;
string binaryNum = Convert.ToString(decimalNum,
2
);//10100
Console.WriteLine(binaryNum);
//Converting binary to decimal
//where binaryString is the binary number expressed as a string.
string binaryString = "10100";
int i = Convert.ToInt32(binaryString,
2
);
Console.WriteLine(i);//20
Console.ReadKey();
}
}
}
Reply
Answers (
4
)
How to use Captcha Image in C# asp.net
Large XML file to Delimited text file