wohhie
7/21/2016 - 5:57 AM

Fibbonacci Series

Fibbonacci Series

#include <stdio.h>

int main() {
	int fib1 = 0,
		fib2 = 1,
		count = 2,
		limit,
		fib3;

	printf("Fibboniaci Series:\n");
	printf("Enter limitation: ");
	scanf("%d", &limit);
	printf("\n");

	printf("%d", fib1);
	printf(" ");
	printf("%d", fib2);

	while (count < limit) {
		fib3 = fib1 + fib2;
		printf(" %d", fib3);
		count++;
		fib1 = fib2;
		fib2 = fib3;
	}


	return 0;
}