
To calculate the Nth root of K you can simply use the formula:
root = K1/N
The following code gets the numbers, calculates the root, and checks the result.
// Calculate the root.
private void btnCalculate_Click(object sender, EventArgs e)
{
double number = double.Parse(txtNumber.Text);
double root = double.Parse(txtRoot.Text);
// Calculate the root.
double result = Math.Pow(number, 1 / root);
txtResult.Text = result.ToString();
// Check the result.
double check = Math.Pow(result, root);
txtCheck.Text = check.ToString();
}
Comments