Created
May 21, 2017 13:11
-
-
Save miteshsureja/2463a8983f354e651ccbdaaba5528da0 to your computer and use it in GitHub Desktop.
Program to display series - 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55 ...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace RandomNumbers | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
int previous = 0, next = 1, sum = 0; | |
for (int i = 1; i < 15; i++) | |
{ | |
if (i == 2) | |
Console.Write("1, "); | |
Console.Write(sum + ", "); | |
sum = previous + next; | |
previous = next; | |
next = sum; | |
} | |
Console.Read(); | |
} | |
} | |
} |
Author
miteshsureja
commented
May 21, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment