Fibonacci Series

C Programming

C Programming Examples

#include<stdio.h>

int main() {
	int start = 0, end = 1, temp = 1, no;
	printf("Generate Fibonacci Series\n");
	printf("Enter a Number:\n");
	scanf("%d", &no);
	printf("\n\nFibonacci Series -\n");
	printf("%d\n", start);
	
	/* Loop the process using "Do While Loop" */
	do {
		printf("%d\n",temp);
		temp = start + end;
		start = end;
		end = temp;		
	}
	while(end < no);

	return 0;
}


          /****** Output ******/
          

Generate Fibonacci Series

Enter a number:

50


Fibonacci Series -

0

1

1

2

3

5

8

13

21

34

Learn more about Fibonacci series