tahamajs's picture
download
raw
556 Bytes
#include "types.h"
#include "stat.h"
#include "user.h"
// Function to calculate Fibonacci numbers recursively
int fibonacci(int n) {
if (n <= 1) return n;
return fibonacci(n - 1) + fibonacci(n - 2);
}
void fibonacci_test(int limit) {
for (int i = 0; i < limit + 1; i++) {
printf(1, "Fibonacci of %d is %d\n", i, fibonacci(i));
}
}
int main(int argc, char *argv[]) {
if (argc < 2) {
printf(1, "Usage: fibonacci <limit>\n");
exit();
}
int limit = atoi(argv[1]);
fibonacci_test(limit);
exit();
}

Xet Storage Details

Size:
556 Bytes
·
Xet hash:
c7c8a0342988ff61de9af6f2ac2cc1e09e2275b44d76fbd1ed37bae681dcd7b0

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.