#include <stdio.h>
int fib(int a);
int main() {
int a;
printf("enter the number\n");
scanf("%d" , &a);
printf("the sequence will be %d" , fib(a));
//code
return 0;
}
int fib(int a){
int f;
if (a == 1 || a == 2){
return 1;
}else{
f = fib(a-2) + fib(a-1);
return f;
}
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter