The classical problem of the classic question of C language 10: Rabbit-born rabbit problem

Source: Internet
Author: User

//2. Classical questions: There are a pair of rabbits, from the third month after birth, every month, a pair of rabbits, the rabbit long to the third month after the birth of a pair of rabbits, if the rabbit is not dead, the total number of rabbits per month? //find Patterns according to questions 1 pairs, 1 pairs, 2 pairs, 3, 5, 8, 13, 21 ... you can find the sum of the total number of rabbits in the first one months from the third month after two months.    intm[ at]; inti; m[0]=m[1]=1;  for(i=0; i< -; i++) {        if(i==0|| i==1) {printf ("the number of rabbits in the first%d months is: 1 pairs \ n", i+1); }        Else{M[i]=m[i-1]+m[i-2]; printf ("the number of rabbits in the first%d months is:%d pairs \ n", i+1, M[i]); }    }

The classical problem of the classic question of C language 10: Rabbit-born rabbit problem

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.