[ create a new paste ] login | about

Link: http://codepad.org/gpfKIswF    [ raw code | output | fork ]

ali.bhz - C++, pasted on Oct 18:
/*
* Author  : ALi Bahrami Nezhad
* Email   : ali.bhz@gmail.com
*/

#include<iostream>
using namespace std;

int main()
{
	int fibonacci_series = 10;
	
	int a = 1;
	int b = 0;
	
	while(fibonacci_series > 0)
	{
		cout << a  << '\t';
		
		int tmp = b;
		b = a;
		a = a + tmp;
		fibonacci_series--;
	}
	
	return 1;
}


Output:
1
1	1	2	3	5	8	13	21	34	55	


Create a new paste based on this one


Comments: