You are on page 1of 1

Thp phn thnh nh phn:

public static int ToDecimal(string bin) { long l = Convert.ToInt64(bin, 2); int i = (int)l; return i; }
Nh phn sang thp phn

public static string ToBinary(int dec) { string str; str = Convert.ToString(dec,2); return str; } chuyn dec sang thap luc phan
string decimalNumber = "32768"; int number = int.Parse(decimalNumber); string hex = number.ToString("x");

You might also like