Converting a Number in Another Base to Base10
using System;
using System.Data;
class Class1{
static void Main(string[] args){
string base2 = "111";
string base8 = "117";
string base10 = "1110";
string base16 = "11F1FF";
Console.WriteLine("Convert.ToInt32(base2, 2) = " +
Convert.ToInt32(base2, 2));
Console.WriteLine("Convert.ToInt32(base8, 8) = " +
Convert.ToInt32(base8, 8));
Console.WriteLine("Convert.ToInt32(base10, 10) = " +
Convert.ToInt32(base10, 10));
Console.WriteLine("Convert.ToInt32(base16, 16) = " +
Convert.ToInt32(base16, 16));
}
}
Related examples in the same category