PROGRAM-2



// 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”)
·                     stop




#vpsinghrajput

Author & Editor

Has laoreet percipitur ad. Vide interesset in mei, no his legimus verterem. Et nostrum imperdiet appellantur usu, mnesarchum referrentur id vim.

1 comments: