using System;
namespace Console_Fabonacci
{
class myclass
{
public void dispFabonacci()
{
int fn = 0, sn = 1, tn, i=2;
Console.WriteLine(fn);
Console.WriteLine(sn);
while (i<8)
{
tn = fn + sn;
fn = sn;
sn = tn;
Console.WriteLine(tn);
i++;
}
}
static void Main(string[] args)
{
myclass obj = new myclass();
obj.dispFabonacci();
Console.ReadKey();
}
}
}
No comments:
Post a Comment