Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

Fibonacci numbers in c++,c

//1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144,
int a=1,b=1;
cout<<a<<" "<<b<<" ";
	for(int i=0;i<10;i++){
		c=a+b;
		a=b;
		b=c;
		cout<<c<<" ";
	}
// 1, 1, 2, 3, 5, 8, 13, 21, 34, ...
// a, b, c,......
//  , a, b, c,.....
//  ,  , a, b, c,....	
Source by www.codegrepper.com #
 
PREVIOUS NEXT
Tagged: #Fibonacci #numbers
ADD COMMENT
Topic
Name
4+8 =