Fibonacci Series

#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

Comments (0)

  • To add your comment please or

We use cookies to improve your experience on our site and to show you personalised advertising. Please read our cookie policy and privacy policy.

Got It!