I was solving the problem... But I don't know why it does when a number greater than 200 is entered, it becomes an infinite loop. I used the recursive function. And I also only can use this function. What should I do?
#include <stdio.h>
int f(int n){
if (n<=0) return 0;
else if(n==1 || n==2) return 1;
else {
return f(n-1)+f(n-2);
}
}
int main()
{
int n;
scanf("%d", &n);
printf("%d", f(n));
return 0;
}