Fibonacci Series in C

Fibonacci is a series of numbers in which each number is the sum of the two preceding numbers. This program prints the first 10 numbers in the Fibonacci Series.

Source code :


#include <stdio.h>

int main(){
    
int i,x,y,n;
x=-1;
y=1;
    
    for (i=0;i<10;i++){
	    
    n=x+y;
    x=y;
    y=n;
    printf("%d\n", n);
		
    }

    return 0;
}


Output :

0
1
1
2
3
5
8
13
21
34

Output :


                

Comments :