Tuesday 7 October 2014

C Program For Fibonacci Series upto 100 by using while Statement



Fibonacci_Series
Fibonacci Series:
  • Fibonacci Series is the Series in which Next Number is Sum of Previous Two Numbers.
  • Example: 0 1 1 2 3 5 8 13 21 34 ............and so on.
Statement of C Program: Write a program to show the Fibonacci Series upto 100:


#include<stdio.h>
#include<conio.h>
void main()


{
int a,b,c;
clrscr();
a=0;
b=1;
while(a<=100)
{
printf("\n%d" ,a);
c=a+b;
a=b;
b=c;
}
getch();
}
Output:
 0
 1
 1
 2
 3
 5
 8
 13
 21 

No comments:

Post a Comment