Cognizant Nexus
Sunday, December 11, 2011
c programming examples
fibonacci series
#include<stdio.h>
#include<conio.h>
void main()
{
int a=0,b=1,i,n,c;
printf("enter the number of terms");
scanf("%d",&n);
printf("\n%d\t%d\t",a,b);
for(i=2;i<=n;i++)
{
c=a+b;
a=b;
b=c;
printf("%d\t",c);
}
getch();
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment