private void btnCreate_Click(object sender, System.EventArgs e) { int [] a = new int[7]; a[0] = a[1] = 1; for (int i = 2; i < 7; ++i) a[i] = a[i - 1] + a[i - 2]; string Fibonacci = a[4].ToString(); MessageBox.Show( "The fifth number in the Fibonacci series is " + Fibonacci, "Arrays", MessageBoxButtons.OK, MessageBoxIcon .Information); }
No comments:
Post a Comment