python ruby-programming-language Smalltalk Vue.js Knockoutjs TypeScript JavaScript, OOPs JavaScript Angular 8,7,6,5,4 and 2 Interview Questions and Answers Angular 8,7,6,5,4 and 2 Interview Questions and Answers Angular 4 Angular 2 AngularJs 1.x NodeJs Perl Programming R Programming RequireJs Rust Programming Backbonejs closure programming language go-programming-language kotlin-programming-language
fibonacci series in c# program

fibonacci series using for loop in c# program

Hello everyone, I am going to share the code sample for the fibonacci series using c# with console application as given below.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1
    public class FibonacciSeries
        public static int fiboSeries(int n)
            int pre_no = -1;
            int next_no = 1;
            for (int i = 0; i < n; i++)
                int sum = next_no + pre_no;
                pre_no = next_no;
                next_no = sum;
            return next_no;

        static void Main(string[] a)
            int number;
            Console.WriteLine("Enter the number.");
            number = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("First " + number + " numbers in the series are equals to ");

OutPut as given below


Hi there! Welcome to my blog. My name is Anil Singh. I'm a author of this blog. For more detail about me, kindly refer to this link..
My Blogs - and
My Books - Interview Questions and Answers Books- Get Your Book in 15+ Digital Stores Worldwide..

You Might Also Like Powered by Blogger.
ASK Questions