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 fibonacci
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
int b, i;
int[] a = new Int32[100];
a[0] = 0; a[1] = 1;
b = Convert.ToInt32(textBox1.Text);
for (i = 2; i <= b; i++)
{
a[i] = a[i - 1] + a[i - 2];
}
label1.Text = a[b].ToString();
}
}
}
Hiç yorum yok:
Yorum Gönder