Student Of Fortune

Fibonacci Series Program With C #.net

Share on :
Fibonaci series is arithmetically with writing numbers as follows:

1 1 2 3 5 8 13 21 34 55 89, etc ...

If you see his pattern correctly, it will be easy to learn this series. The way this series is the sum of the first number by the second number (after the first number) and the result is the third digit (digits after the second figure).
Well, now that we know how to work this series, how to make his program, Let's get started:

The syntax : 

[source code language = "csharp"]  
Class program
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DeretFibonaci
{
Algorithm class
{
public void fibonaci (int x)
{
int number 1 = 0, number 2 = 1, temp;
Console.Write(number 2 + " ");

for (int i = 1; i < x; ++i)
{
int number 1 = 0, number 2 = 1, temp;
Console.Write (number 2 + "");

for (int i = 1; i <x; + + i)
{
/ / temp variable to hold the temporary value of number 2
temp = number 2;

number 2 + = digit 1;
Console.Write (number 2 + "");
/ / insert value of temp in again to angka1
number 1 = temp;
}
}
}
} [/ source code]
 

Main Program 
[source code language = "csharp"]  
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DeretFibonaci
{
class Program
{
static void Main (string [] args)
{
/ / initialize the object named series,
Algorithm Rows = new  Algorithm ();
Console.Write ("Enter Number of Runs:");
string n = Console.ReadLine ();
int number = Convert.ToInt16 (n);
deret.fibonaci (number);
}
}
} [/ source code]

0 comments on Fibonacci Series Program With C #.net :

Post a Comment and Don't Spam!

Dont Spam please

 
Recommended Post Slide Out For Blogger

Recent Comments

My Rank