I am new to programming. I'm trying to make a program that stores 2 values that the user enters, and show the result in the 3rd variable => c = 2 ^ (b / a);
Here's what I've tried:
public int a;
public int b;
public int c;
public Form1()
{
InitializeComponent();
}
public void StepAmount_TextChanged(object sender, EventArgs e)
{
a = int.Parse(stepAmount.Text);
}
public void StepNo_TextChanged(object sender, EventArgs e)
{
b = int.Parse(stepNo.Text);
}
public void DecValue_TextChanged(object sender, EventArgs e)
{
c = 2 ^ (b / a);
}
public void Calculate1_Click(object sender, EventArgs e)
{
c = int.Parse(decValue.Text);
}
CodePudding user response:
Do you want to release the result when the button is clicked? If so, this must be the code inside the button click event.
public void Calculate1_Click(object sender, EventArgs e)
{
c = 2 ^ (b / a);
decValue.Text = c.ToString();
}