The following C# program is to print the Fibonacci series.
using System;
public class Program
{
public static void Main()
{
int a=0,b=1,c,num,i;
Console.WriteLine('Enter the number of element in Fibonacci Series.');
num= int.Parse(Console.ReadLine());
for(i=1;i<=num;i++)
{
c=a+b;
Console.Write(b+' ');
a=b;
b=c;
}
}
}
Output:
Enter the number of element in Fibonacci Series. 10
1 1 2 3 5 8 13 21 34 55
Markdown for AI
A clean, structured version of this page for AI assistants and LLMs.
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy.
Program:
The following C# program is to print the Fibonacci series.
Output:
Enter the number of element in Fibonacci Series. 10
1 1 2 3 5 8 13 21 34 55