Traditional Culture Encyclopedia - Photography major - C language: rabbit reproduction problem
C language: rabbit reproduction problem
The logarithm of rabbit is Fibonacci sequence.
# include & ltstdio.h & gt
Long f (long n)
{
If (n<3) returns1;
Otherwise, it returns f (n-2)+f (n-1);
}
void main()
{
Printf ("A year later, there were %ld rabbits. \n ",f( 12));
getch();
}
-
1 1 2 3 5 8 13 2 1 34 55 89 ...
- Related articles
- What are the styles of children's photography?
- English experts help translate two paragraphs of English ~
- What information do I need to prepare to purchase a house in Tianjin and withdraw the provident fund?
- How much is the copyright fee for registration? -How much is the copyright fee for photographic photos?
- Brief introduction of Zhang Lei in the fourth season of China Voice, who is Zhang Lei's wife?
- Pay attention to art photos
- Four-word column names about family ties
- Working room use method
- What is the difference between Korean guide ring and Fuji guide ring?
- How to take pictures of the super moon with your mobile phone