title: Count the number of cows after N number of years
body: <p>A cow has a calf every year. A calf becomes a cow in 2 years, starting with one cow we have to count how many animals are there in N years.
  Suppose no cow ever dies...</p>
  
  <p>eg at N=5:</p>
  
  <p>1st cow gave 2 calves(1 at the age of 2 another at the age of 3, next at 4, next at 5)
  total= 4 calves
  now the first cow is also already 3 year old so (she gave birth to 1 calf at the age of 2 another at the age of 3)
  total = 2 calves.
  the second cow must also be 2 year old so she just gave birth to another calf
  total = 1 calf.</p>
  
  <p>sum = 1+4+2+1</p>
  
  <p>The reccursion goes on as the year increases</p>
  
  <p>I  recently got this question at an exam.
  I tried using recursion, I'm just a beginner and I'm not getting it right.</p>
  
  <pre><code>public static void main(String args[]) {
      Scanner sc =new Scanner(System.in);
      int n= sc.nextInt();
      sc.close();
      fun(n);
  }
  public static void fun(int age) {
      int arr[] = new int[age-1];
      int temp=0, sum=1;
      for(int i=age-2; i&gt;=0; i--){
          arr[temp++]=i;
      }
      sum+=arr.length;
      for(int j=0; j&lt;age-1; j++) {
          if(arr[j]&gt;=2) {
              fun(j);
          }
      }
      System.out.println(sum);
  }
  </code></pre>