I have to make a little program to calculate a certain iteration of the fibonacci sequence. right now, it always gives out a 2, no matter what i do...
public partial class Form1 : Form
{
int num1=0;
int num2=1;
int sum=0;
public Form1()
{
InitializeComponent();
}
private void btnCal_Click(object sender, EventArgs e)
{
for (int z = 0; z <= Convert.ToInt32(txtCal.Text); z++)
{
sum = num1 + num2;
lblErg.Text = Convert.ToString(sum);
num1 = num2;
sum = num1;
}
}