This blog consists of C and C++ programs. C and C++ programming is the basics to learn any programming language. Most of the programs are provided with their respective outputs. This blog also contains Data Structures programs using Object-Oriented Programming (C++). Some of the best books for learning C and C++ programming are also mentioned.

Wednesday 5 June 2013

Program to find the Fibonacci Series using FOR loop (1)



#include<stdio.h>
void main()
{
int a,b,c,i,n;
clrscr();
a=-1;
b=1;
printf("Enter the number of terms: ");
scanf("%d",&n);
for(i=0;i<=n;i++)
{
c=a+b;
printf("%d\n", c);
a=b;
b=c;
}
getch();
}

No comments:

Post a Comment