[plain]
#include <stdio.h>
int fibonacci(int num);
int main()
{
int num;
int sum;
printf("please enter a number:");
scanf("%d", &num);
sum=fibonacci(num);
printf("The result is %d\n", sum);
return 0;
}
int fibonacci(int num)
{
int sum;
if(num==1 || num==2)
{
sum=1;
}
else
{
sum=fibonacci(num-1)+ fibonacci(num-2);
}
return sum;
}
#include <stdio.h>
int fibonacci(int num);
int main()
{
int num;
int sum;
printf("please enter a number:");
scanf("%d", &num);
sum=fibonacci(num);
printf("The result is %d\n", sum);
return 0;
}
int fibonacci(int num)
{
int sum;
if(num==1 || num==2)
{
sum=1;
}
else
{
sum=fibonacci(num-1)+ fibonacci(num-2);
}
return sum;
}