Try the following program

Write a C program that generates a fibonacci sequence. A no. in a fibonacci sequence is generated by adding the previous two numbers in the sequence i.e. the fibonacci sequence is 1, 1, 2, 3, 5, 8, 13, 21, ...........

/* Generating Fibonacci's series 1,1,2,3,5,8,13,.... */

main( )
{
int m, n, i;

m= 0;
n= 1;

printf("%d\n", n);

for ( i= 1; i< 11; i++)

{
m= m+n;

printf("%d\n", m);

n= n+m;

printf("%d\n", n);

}
}

The output of this program will be
1
1
2
3
5
8
13
21
34
55
89
144
233
277
610
987
1597
2584
4181
6765
10946
17711
28657