You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
261 B
21 lines
261 B
5 years ago
|
#include <stdio.h>
|
||
3 years ago
|
#include <stdint.h>
|
||
|
|
||
|
uint32_t
|
||
|
fib(uint32_t n)
|
||
5 years ago
|
{
|
||
|
if (n <= 1) return n;
|
||
|
return fib(n - 1) + fib(n - 2);
|
||
|
}
|
||
5 years ago
|
|
||
|
int
|
||
5 years ago
|
main(int argc, char **argv)
|
||
|
{
|
||
3 years ago
|
uint32_t n = 0;
|
||
|
scanf("%u", &n);
|
||
5 years ago
|
|
||
3 years ago
|
uint32_t result = fib(n);
|
||
|
printf("%u\n", result);
|
||
5 years ago
|
return 0;
|
||
|
}
|