using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FeboMgr : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
int num= Feb(10);
Debug.Log(num);
int num1 = FebLoop(10);
Debug.Log(num1);
}
private int Feb(int n)
{
int num;
if (n == 1 || n == 2)
{
return 1;
}
num = Feb(n - 1) + Feb(n - 2);
return num;
}
private int FebLoop(int n)
{
int a = 1;
int b = 1;
for (int i = 3; i < n; i++)
{
a = a + b;
b = a - b;
Debug.Log(a);
}
return a + b;
}
}