// Program to print Fibonacci series
#include
#include
void main()
{
int i,c,n,a=0,b=1;
clrscr();
printf("enter the number of terms: ");
scanf("%d", &n);
printf("%d\n%d\n", a,b);
for(i=1; i<=n-2; i++)
{
c=a+b;
printf("%d\n", c);
a=b;
b=c;
}
getch();
}
Algorithm
· Start
· Declare i, c, n, a, b as integer
· Write (“number of terms”)
· Read (“n”)
· Read (“a,b”)
· for(i=1; i<=n-2; i++)
c = a + b
a = b
b = c
· Read (“c”)
c programming example codes
ReplyDeletec code to list the command line arguments