Write a C program in Fibonacci series.



Write a C program in Fibonacci series...

Answer / Upendra

Here is a simple solution using recursion.nn```cnint fib(int n) {n if (n <= 1) return n;n else return fib(n-1) + fib(n-2);n}n```

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Interview Questions

what is difference between ANSI structure and C99 Structure?

1 Answers   Wipro,


What is the time and space complexities of merge sort and when is it preferred over quick sort?

1 Answers   Amazon,


Can we include one C program into another C program if yes how?

7 Answers   Infosys,


Why can’t constant values be used to define an array’s initial size?

1 Answers  


In C language, a variable name cannot contain?

1 Answers  


#include<stdio.h> void main() { int a=5,b=6,c; int x=(a<b)+7; int y=(x==7)*9; int z=(c=x+y)*2; printf("%h %h %h",x,y,z); } What is the output? Explain it.

8 Answers   IBM,


what is the program to display your name in any color?

2 Answers   HCL,


printf(), scanf() these are a) library functions b) userdefined functions c) system functions d) they are not functions

1 Answers  


What is the function of ceil(X) defined in math.h do? A)It returns the value rounded down to the next lower integer B)it returns the value rounded up to the next higher integer C)the Next Higher Value D)the next lower value

3 Answers   Accenture, Wipro,


What is the symbol indicated the c-preprocessor?

1 Answers  


What is the use of the #include directive?

3 Answers  


What is the significance of c program algorithms?

1 Answers  


Categories