If you don’t know the Fibonacci sequence as a programmer, you are probably not a qualified programmer.

Go directly to the code:

#include <Stdio.h> void foo(int n) { if(n<=0) { printf("%d",0); return; }else if(n==1) { printf("%d",1); return; }else { int a=0,b=1,tmp=1; for(int i=2; i<=n; i++) { printf("%d->",a); tmp=a+b; a=b; b=tmp; } } } int main() { int n=20; foo(n); }Copy the code