View Code of Problem 3695

#include<iostream>
using namespace std;
int main()
{
	int t,n,array[101];
	array[1]=1;array[2]=2;
	cin>>t;
	while(t--)
	{
		cin>>n;
		for(int i=3;i<=n;i++)
		  array[i]=array[i-1]+array[i-2];
		  
		cout<<array[n]<<endl; 
	}
}

Double click to view unformatted code.


Back to problem 3695