Basic Programs
If Else based Programs
Loop Based Programs
Array Based Programs
String Programs
Function Programs
Pointers Programs
Structure & File Handling Programs
Data Structure Programs
Loop based Programs
C Program to generate fibonicci series
fibonacci series is — 1 1 2 3 5 8 ………. (last number is the sum of two previous numbers)
#include <stdio.h> #include <conio.h> void main() { int limit=0, a=1, b=1, c=0, i=0; printf("enter the limit "); scanf("%d",&limit); printf("%d %d ",a,b); while(i<(limit-2)) // loop executes 2 times less because 2 nos a& b printed already { c=a+b; printf("%d ",c); a=b; //change to values to move forward b=c; i++; } }
Output of the above program is as following.
Video/ C Introduction
Watch video in full size