Generate fibonacci Serices using c# with console Program
Hi all
this is a basic Programming style, this will use in dam difficult situations, this too much easy to remember. So that , you may easy recognize this code.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace fibonacciSeries
{
class Program
{
static void Main(string[] args)
{
//0 , 1,1,2,3,5,8,13
Console.Write("Please enter a Value for fibonacci series: ");
int a = Convert.ToInt32(Console.ReadLine());
int r = 1;
for (int i = 0; i < a; i = i + r)
{
Console.Write("r : " + r + " ");
r = r + i;
Console.Write("\n i : " + i + " ");
}
Console.Write("r : " + r + " ");
Console.ReadKey();
}
}
}
this is a basic Programming style, this will use in dam difficult situations, this too much easy to remember. So that , you may easy recognize this code.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace fibonacciSeries
{
class Program
{
static void Main(string[] args)
{
//0 , 1,1,2,3,5,8,13
Console.Write("Please enter a Value for fibonacci series: ");
int a = Convert.ToInt32(Console.ReadLine());
int r = 1;
for (int i = 0; i < a; i = i + r)
{
Console.Write("r : " + r + " ");
r = r + i;
Console.Write("\n i : " + i + " ");
}
Console.Write("r : " + r + " ");
Console.ReadKey();
}
}
}
Out Put is:
Comments
Post a Comment