Fibonacci numbers are a series of numbers in which each number is formed by adding previous two numbers in the series. For example, we start by 1 and 2, and then repetitively add the add the numbers to result in the next number. For a given max limit 10, we would want to find the first 10 Fibonacci numbers. Series: 1,2,3,5,8,13,21,34,55,89

```
public static List<int> DoGetFibonacci(int n)
{
int a = 1, b = 2, c = 0;
List<int> series = new List<int>();
series.Add(a);
series.Add(b);
while (series.Count < n)
{
c = a + b;
a = b;
b = c;
series.Add(c);
}
return series;
}
```

**How it works:**

The core of Fibonacci series is adding up previous two numbers a and b to form the next number c. Taking this as the base we build the logic and put it in a loop to iteratively generate the series.

Special Numbers Loops • Added 2 months ago

Find if the given number is a Perfect Number

Special Numbers
Loops

Find if the given number is a Palindrome

Special Numbers
Loops

Find if the given number is an Armstrong Number

Special Numbers
Loops

Find if the given number is a Perfect Square

Special Numbers
Loops

Find all the Fibonacci numbers for a given limit

Special Numbers
Loops

Find the number of occurrences of a given character in a string

Strings
Loops

Find the reverse of given number

Loops

Find the Factorial of a given number using Recursion

Recursion
Loops

Check if a given string is Palindrome

Strings
Loops

Find if the given number is a Perfect Number

Special Numbers
Loops

Subscribe to my newsletter and get the first copy of every new post delivered straight into your inbox.

Externalizing Configurations to AWS SSM Parameter Store and using in ASP.NET Core API

AWS
ASP.NET Core

Working with Options pattern in ASP.NET Core - The Complete Guide

ASP.NET Core

Creating AWS Lambda Layers in ASP.NET Core - Getting started

AWS
ASP.NET Core

Deploying Express.js API to AWS Lambda and API Gateway

NodeJS
Express
MySql
AWS

Securing ASP.NET Core APIs with IdentityServer4 - Getting Started

ASP.NET Core
IdentityServer4