Skip to content

Instantly share code, notes, and snippets.

@miteshsureja
Created May 21, 2017 13:11
Show Gist options
  • Save miteshsureja/2463a8983f354e651ccbdaaba5528da0 to your computer and use it in GitHub Desktop.
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 ...
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();
}
}
}
@miteshsureja
Copy link
Author

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment