Printing and adding fibonacci series - c# program, DOT NET Programming

Assignment Help:

Printing and adding Fibonacci series - C# Program

Hello guys i need your advice. How can i print and add Fibonacci series in my project. Please recommend some examples.


Related Discussions:- Printing and adding fibonacci series - c# program

I need a experienced microsoft .net web developer, Experienced Microsoft .N...

Experienced Microsoft .NET web developer The developer must be reliable as well as most of all use best practices for coding as well as application design. a) .NET 3.5 (ideal

Car (causal analysis and resolution), What is CAR (Causal Analysis and Reso...

What is CAR (Causal Analysis and Resolution)? The basic purpose of the CAR is to analyze all the problems, defects, and good practices/positive triggers in projects, perform a

Project spending, Is spending in projects constant throughout the project? ...

Is spending in projects constant throughout the project? Generally in initial stage of projects (design and requirement phase) the cost is very less (as you require maximum bus

What is a node, What is a node? A network can have of two or more compu...

What is a node? A network can have of two or more computers directly linked by some physical medium such as coaxial cable or optical fiber. Such a physical medium is known as L

Implement singleton pattern in .net, How can we implement singleton pattern...

How can we implement singleton pattern in .NET ? The Singleton pattern basically focuses on having one and only one instance of the object running. Lets take an e.g. a windows

I need a custom report - crystal reports, I need a Custom Report - Crystal ...

I need a Custom Report - Crystal Reports Project Description: I am seeking a custom report for our syrinx hire software, all reports are made from Crystal Reports. Skills

What is a parameter, What is a parameter? Explain the new types of paramete...

What is a parameter? Explain the new types of parameters introduced in C# 4.0. A parameter is a special type of variable, which is used in a function to give a piece of informa

Uml in dot.net programming, Give a small explanation of all Elements in the...

Give a small explanation of all Elements in the diagram. Action State: - This is a type of state that has an internal action and one outgoing event that would do the int

Different types of DOT NET programming, Could you please explain to me the ...

Could you please explain to me the different types of DOT NET programming

Difference between system exceptions and application excepti, What is the d...

What is the difference between System exceptions and Application exceptions? All exception is derived from Exception Base class. Exceptions are generated programmatically or ca

david

2/12/2013 12:05:09 AM

Hey you should implement the below code in your project.

Program:

using System;  

class Fibonacci 

{

  public static void Main()

 {

   int first = 1, second = 1, third, no, count = 0;

   long sum = 2;

   // ''first'', ''second'', ''third'' are the first, second & third numbers in the fibonacci series

   // ''first'' & ''second'' are both initialised to 1

   // sum of ''first'' & ''second'' are added to the ''third'' variable

   // ''sum'' will contain the sum of all the digits in the fibonacci series. It is initialies to 2 coz sum of first 2 digits is 2

   // ''no'' is the number inputted from the console up till which the fibonacci series is displayed

   // ''count'' counts the number of digits in the fibonacci series    

  Console.Write("Enter the number uptill which you want the fibonacci numbers :

");

  no = int.Parse(Console.ReadLine());    

   if (no >= 45)

  {

    // checking for values out of range.

   Console.WriteLine("Out of range values. Dont enter more than 45.");

    goto exit;

  }

  Console.Write("Fibonacci Series : 1 1");

   // Initial 2 numbers of the fibonacci series are just ''1'' & ''1'', thus writing it directly  

   do

  {

   third = first + second;

    // adding ''third'' = ''first'' + ''second''  

   Console.Write(" "+third);

    // display the ''third'' digit in the series     

   first = second;

    // make ''first'' digit, the ''second'' one

   second = third;

    // make ''second'' digit, the ''third'' one  

    // we did this coz in fibonacci series, each digit is a sum of previous 2 digits  

   count = count + 1;

    // increment the counter  

   sum = sum + third;

    // add the sum in the ''sum'' variable from ''third'' variable

  }

   while((count + 3) <= no);

   // we entered the ''no'' from the console & also the first 2 digits are not from this loop  

// thus we added +3 here to the ''count'' variable so that we get the exact specified no. of digits.

// if we didnt added 3, then the series will go beyond the specified number of digits from the console via ''no''

  Console.WriteLine("\nSum of all fibonacci digits : " +sum);

   // Display the sum

  exit:

  Console.ReadLine();

 }

}

Aliena

2/12/2013 12:05:55 AM

Thanks dear, I have been looking for this, want to know more. Please upload some these types of examples more.

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd