Monday, 24 December 2012
Printing the Fibonacci series:
Do you like this story?
Program for Printing the Fibonacci series:
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c,range,i=2;
clrscr();
printf("Enter How many numbers you want to get printed:");
scanf("%d",&range);
a=0;
b=1;
printf("%d,%d",a,b);
while(i!=range)
{
c=a+b;
a=b;
b=c;
i=i+1;
printf(",%d",c);
}
getch();
}
and the output is like:
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c,range,i=2;
clrscr();
printf("Enter How many numbers you want to get printed:");
scanf("%d",&range);
a=0;
b=1;
printf("%d,%d",a,b);
while(i!=range)
{
c=a+b;
a=b;
b=c;
i=i+1;
printf(",%d",c);
}
getch();
}
and the output is like:
This post was written by: Franklin Manuel
Franklin Manuel is a professional blogger, web designer and front end web developer. Follow him on Twitter
Subscribe to:
Post Comments (Atom)
0 Responses to “Printing the Fibonacci series:”
Post a Comment