Talk C Chestnut Bar (fourth time: C-language example-Fibonacci series)

Source: Internet
Author: User


Crossing, everyone, from today onwards, we talk about the large-scale couplet science fiction: C Chestnut, that is, C language examples. Gossip Hugh,

Words return to the positive turn. Let's talk about C language examples together!


Crossing, the last time we were talking about the example of factorial, the example we're talking about is the Fibonacci sequence.


Crossing, the Fibonacci sequence is named after the mathematician's Fibonacci sequence name. The definition of the Fibonacci sequence: items No. 0 and 1th of the series

is 1, and the nth item is the n-1 of subparagraphs and n-2. It is represented by a mathematical formula: F (N) =f (n-1) +f (n-2), wherein (N>1), f (n) =1, (n=0,1).


Crossing, I used a recursive method in my program to implement the Fibonacci sequence, which is the same as for factorial. But nothing like factorial.

Use the same loop method to implement the Fibonacci sequence. The text will not write code, the detailed code in my resources, we

You can download it by clicking the link.


One thing to add: The Fibonacci sequence and the algorithm thought behind the factorial are the same. They all use the idea of recursion.


You crossing, here's an example of the Fibonacci sequence. I want to know what the following example, and listen to tell.


Talk C Chestnut Bar (fourth time: C-language example-Fibonacci series)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.