public class homework1 {
/*public static void main(String[] args) {
System.out.println(fun(12));
}
public static int fun(int num) {
if(num == 1 || num == 2) {
return 1;
}else {
return fun(num - 2) + fun(num - 1);
}
}*/
public static void main(String[] args) {
int[] arr=new int[12];
arr[0]=1;
arr[1]=1;
for (int i = 2; i <arr.length; i++) {
arr[i]=arr[i-1]+arr[i-2];
}
System.out.println(arr[arr.length-1]);
}
} |