Fibonacci series:-

public static void PrintFibonacciSeries(int limit) {

int digit1, digit2, digit3;

digit1 = 0;

digit2 = 1;

digit3 = digit1 + digit2;

Console.WriteLine(digit1);

Console.WriteLine(digit2);

Console.WriteLine(digit3);

for (int i = 0; i < limit; i++) {

digit1 = digit2;

digit2 = digit3;

digit3 = digit1 + digit2;

Console.WriteLine(digit3);

}

}

Calling above method,

static void Main(string[] args) {

clsFibonacci.PrintFibonacciSeries(10);

Console.ReadLine();

}

Output:

results matching ""

    No results matching ""