I'm wanting to create a basic program to enable me to convert binary numbers into decimal numbers, but having looked almost everywhere on the internet, I just can't find a solution to this that works! I can't seem to follow the solutions, So far I've developed a bit of code, but not sure if it is correct or not, any help? Thanks
int iBinaryNum; //To store binary number
string sDecimalNum; //To store decimal numbers
Console.WriteLine("Enter the binary number you want to convert to decimal");
iBinaryNum = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("The Binary number you have entered is " + iBinaryNum);
sDecimalNum = Convert.ToString(iBinaryNum, 2);
Console.WriteLine("This converted into decimal is " + sDecimalNum);
//Prevent program from closing
Console.WriteLine("Press any key to close");
Console.ReadKey();