I'm try to write program can take a decimal number from user by interface form by TextBox tool.. I called it
"txtInput"
then convert it to Binary number and show the result in another TextBox called
"txtOutput"
but I think there's missing something I can't know it because I got this message in "txtOutput"
System.Int32[]
this is my code
private void BtnConvert_Click(object sender, EventArgs e)
{
int [] binNum = new int [32]; //Declartion Array var to store binary number
int num = int.Parse(txtInput.Text); // Copy input number in num var
int i = 0;
while (num > 0) {
binNum[i] = num % 2;
num/= 2;
i++;
}
//Reverse binNum
for (int j = i - 1; j >= 0; j--)
{
Console.Write(binNum[j]);
txtOutput.Text = binNum.ToString();
}
}
where ever I put txtOutput.Text = binNum.ToString();
inside or outside "for" I got same result.