using System;

class Fibonacci
{
public static void Main(string [] arg)
{
int num;
int f[] =new int[15];
Fibonacci()
{
f[0]=1;
f[1]=1;
}
void accept()
{
Console.WriteLine("Enter the number :\t");
num =Convert.ToInt32(Console.ReadLine());
}
for(int i=2; i<=num;i++) { f[i]=f[i-1]+f[i-2]; Console.WriteLine(f[i]); } } } Note:

When u write a program using C sharp u have to save the file with ' .cs' extension.

example: Fibonacci.cs

compilation mtd: csc Fibonacci.cs

execution mtd: Fibonacci.cs

0 Comments:

Post a Comment



Newer Post Older Post Home