Re: FIbonacci
- From: "Peteris Krumins" <peteris.krumins@xxxxxxxxx>
- Date: 11 Dec 2005 08:15:56 -0800
MARQUITOS51 wrote:
> Hey guys this is the fibonacci series. But Im having this huge problem.
> First of all I want to do the simplest code possible so then I can use
> user defined functions and arrays. But this one didnt came out well.
> Any suggestions!
>
#include <stdio.h>
unsigned fib(unsigned n) {
return n <= 2 ? 1 : fib(n - 1) + fib(n - 2);
}
int main(void) { printf("fib(17) is: %d\n", fib(17)); return 0; }
P.Krumins
.
- Follow-Ups:
- Re: FIbonacci
- From: Eric Sosman
- Re: FIbonacci
- From: Alex Fraser
- Re: FIbonacci
- References:
- FIbonacci
- From: MARQUITOS51
- FIbonacci
- Prev by Date: Re: FIbonacci
- Next by Date: Re: statistic of integer values
- Previous by thread: Re: FIbonacci
- Next by thread: Re: FIbonacci
- Index(es):
Relevant Pages
|