예제 #1
0
        private void button5_Click(object sender, EventArgs e)
        {
            double num = Convert.ToInt32(number.Text);
            int    rad = Convert.ToInt32(radix.Text);

            NewtonRaphson.Start(output, num, rad);
        }
예제 #2
0
 public static void Start(RichTextBox output, double num, int rad)
 {
     if (rad == 1)
     {
         output.AppendText($"The 1st root of {num} is {num}" + Environment.NewLine);
     }
     else if (rad == 2)
     {
         output.AppendText($"The square root of {num} is {NewtonRaphson.Sqrt(num, rad)}" + Environment.NewLine);
     }
     else if (rad == 3)
     {
         output.AppendText($"The third root of {num} is {NewtonRaphson.Sqrt(num, rad)}" + Environment.NewLine);
     }
     else
     {
         output.AppendText($"The {rad}th root of {num} is {NewtonRaphson.Sqrt(num, rad)}" + Environment.NewLine);
     }
 }