View Code of Problem 23

#include <iostream>
using namespace std;
int main(){
	int m;
	while(cin>>m){
		if(m==0) break;
		int small = 1;
	 	int big = 0;
	 	int temp; 
		for(int i=0;i<m;i++){
			temp = big;
			big = big + small;
			small = temp;
		}
		cout<<big+small<<endl;
	}
}  

Double click to view unformatted code.


Back to problem 23