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

Why is it preferred to not use finalize for clean up, The Problem with fina...

The Problem with finalize is that the garbage collection has to make 2  rounds in order to remove the  objects which have finalize methods. The figure below will make things cle

Academic expert for genetic algorithm, I need Academic expert for Genetic A...

I need Academic expert for Genetic Algorithm Project Description: Seeking academic expert for Genetic Algorithm. Please bid on this project if you will start work today. S

What is an identifier, What is an identifier? Identifiers are northing ...

What is an identifier? Identifiers are northing but names given to various entities uniquely identified in a program. The name of identifiers must vary in spelling or casing. F

Iuknown interface, Describe IUKNOWN interface All COM object supports a...

Describe IUKNOWN interface All COM object supports atleast one interface, that is  IUnknown interface. All interfaces are the classes, derived from the base class IUnknown. Eve

Basic use of "dataview", What is basic use of "DataView"? The "DataView...

What is basic use of "DataView"? The "DataView" represents the whole table or can be small parts of rows depending on some criteria. It is the best used for sorting and finding

Android to pc communications via bluetooth, Project Description: I am lo...

Project Description: I am looking an app that mimics this app presently available here [justremotephone.com]. It has a nice set of features but also lacks a lot when it comes to

Develop a windows backup application, Develop a Windows Backup Application ...

Develop a Windows Backup Application Application Goal The goal is to prepare an easy to use application that provides the user peace of mind that all of their firewalls are b

Print triangle in reverse pattern - c# program, Print Triangle in Reverse P...

Print Triangle in Reverse Pattern - C# Program Need the code of C# Program for Print Triangle in Reverse Pattern.

Raise custom errors from stored procedure, How can you raise custom errors ...

How can you raise custom errors from stored procedure? The RAISERROR statements are  used to produce an ad hoc error message or to retrieve acustom message which is stored in t

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