Untitled
unknown
plain_text
6 months ago
401 B
4
Indexable
#include "stdio.h" // To create a function, two steps: // 1. Declearation `{output_type} {name of the function}({input args})` `args: type name` int x // 2. Definition int fib(int x) { // init if (x == 1) return 1; // fib(1) else if (x == 2) return 1; // fib(2) // recur return fib(x-1) + fib(x-2); } int main() { printf("%d\n", fib(6)); return 0; }
Editor is loading...
Leave a Comment