C#构建窗体类应用程序
如何在C#中构建窗体类应用程序,实现计算斐波那契数列的第n项。。。。。。。。。。。。。。
回答

using System;using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Q1086908
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private int f(int n)
        {
            if (n == 1 || n == 2) return 1;
            return f(n - 2) + f(n - 1);
        }
        private void button1_Click(object sender, EventArgs e)
        {
            label1.Text = f(int.Parse(textBox1.Text)).ToString();
        }
    }
}
问题解决的话,请点下采纳
以上是 C#构建窗体类应用程序 的全部内容, 来源链接: utcz.com/a/27161.html

