mirror of
https://github.com/eunomia-bpf/bpf-developer-tutorial.git
synced 2026-02-04 02:34:16 +08:00
23 lines
354 B
C
23 lines
354 B
C
/*
|
|
* The sample program is used to generate test.bin.
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
|
|
static
|
|
unsigned int fibonacci(unsigned int n) {
|
|
if (n <= 1)
|
|
return n;
|
|
return fibonacci(n - 1) + fibonacci(n - 2);
|
|
}
|
|
|
|
int
|
|
main() {
|
|
int i;
|
|
printf("calculate fibonacci(n); n = ");
|
|
scanf("%d", &i);
|
|
|
|
printf("fibonacci(%d) = %d\n", i, fibonacci(i));
|
|
return 0;
|
|
}
|