title: Recursively nested Radicals C++
body: <p>I'm trying to write a function for the first n terms of <code>sqrt(1+sqrt(2+sqrt(3+...)))</code> in C++. The constraint is that the function must be recursive and take n (the depth of the nest) as the only parameter. I do not need to return the expression itself, just what it evaluates to. For example:</p>
  <pre><code>n=1 -&gt; sqrt(1)                 # which evaluates to 1  
  n=2 -&gt; sqrt(1+sqrt(2))         # which evaluates to 1.55377  
  n=3 -&gt; sqrt(1+sqrt(2+sqrt(3))) # which evaluates to 1.7122 
  </code></pre>
  <p>I've tried:</p>
  <pre><code>float nestedRadical(float n){
     if (n==1){
         return sqrt(1);
     }else{
         return sqrt(n + nestedRadical(n-1));
     }
  }
  </code></pre>
  <p>This code causes <code>1</code> to be the most deeply nested radical, when it should be the highest. How should should I approach this problem?</p>