Home » NO IDEA » Fibonacci Series

Fibonacci Series

Blog Stats

  • 13,632 hits
December 2013
M T W T F S S
« Oct   Jan »
 1
2345678
9101112131415
16171819202122
23242526272829
3031  
//Develop a ‘C’ program to print first ‘n’ terms of the Fibonacci series
#include<stdio.h>
int main()
{
	int a,b,c,i;
	a=-1;
	b=1;
	printf("\n\t\t ‘C’ program to print first ‘n’ terms of the Fibonacci series");
	printf("\n Enter the terms till series has to be generated=");
	int n;
	scanf("%d",&n);
	printf("\n The Fibonacci Series \n");
	for(i=0;i<n;i++)
	{
		c=a+b;
		a=b;
		b=c;
		printf("%d\n",c);
	}
	return 0;
}
Advertisements

1 Comment

  1. […] write a c program for Fibonacci series […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: