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

Install modules to enhance site proformance, Install Modules to enhance Sit...

Install Modules to enhance Site Proformance Project Description: As shown, I need the subsequent modules installed, to improve loading time for my graphics and images, improv

Briefly explain how server form post-back works, Briefly explain how server...

Briefly explain how server form post-back works ?  Post Back: The process in which a Web page sends data back to the similar page on the server. View State : View State i

Develop mobile web app, Project Description: This project uses Microsoft...

Project Description: This project uses Microsoft Visual Studio 2010/2012, Internet Information Services (IIS) Manager and Microsoft SQL Server Management Studio. It is a Mobi

What is the purpose of dotnet, What is the purpose of DOTNET? Dot Net I...

What is the purpose of DOTNET? Dot Net Is a collection of products like C#, ASp.Net, Vb.Net, XML. The purpose of .Net is that we can simply upgrade and degrade our programs whi

Powershell, how to replace a keyword using powershell

how to replace a keyword using powershell

File upload in asp.net, upload files using file upload control to google dr...

upload files using file upload control to google drive

Pollution software vehicle, Project Description: i want to prepare a pol...

Project Description: i want to prepare a pollution checking software.. i have a demo of it.. Exactly someone to be created ..some changes to be included.. sms gateway t

What are major difference between classic ado and ado.net, What are major d...

What are major difference between classic ADO and ADO.NET? Following are some major differences among both In ADO we have recordset and in ADO.NET we have dataset. In rec

Advantages of using permission sets and code groups, This assignment docume...

This assignment document will be distributed from Blackboard assignment folder. Some parts of the assignments will require you to research answers from your text book (you must rea

Different transaction levels in sql server, What are different transaction ...

What are different transaction levels in SQL SERVER? The Transaction Isolation level decides how is the one process isolated from theother process. Using the transaction levels

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