|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace Fibonacci
{
public partial class MainForm : Form
{
public MainForm()
{
InitializeComponent();
}
private void btnCalculate_Click(object sender, EventArgs e)
{
txtResult.Text = Fibonacci(10).ToString();
}
static int Fibonacci(int x)
{
if (x <= 1)
{
return 1;
}
return Fibonacci(x - 1) + Fibonacci(x - 2);
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.