Programming for Problem Solving

GTU Practical 19

19. Write a program to generate the first n number of the Fibonacci series
#include<stdio.h>  ( this applies in the given code )

#include

int main()
{
int no=10,i=0,j=1;
printf(” %d %d”,i,j);
while(no>0)
{
printf(” %d”,i+j);
j=i+j;
i=j-i;
no–;
}
return 0;
}

OUTPUT

0 1 1 2 3 5 8 13 21 34 55 89

GTU STUDY