This is a c program. it is very important and usefull in interviews.
1. Open the turbo c compiler.
2. Write this c code.
3. Run and give a succesfully output.
C CODE:
- #include < stdio.h >
- main()
- {
- int a, b, c, count = 0, i, n;
- printf("\n enter the limit");
- scanf("%d", & n);
- a = -1;
- b = 1;
- for (i = 1; i <= n; ++i)
- {
- c = a + b;
- count = count + 1;
- a = b;
- b = c;
- printf("\n %d", c);
- }
- }
The Fibanaci program is successfully completed.