title: Series: 1 + 1/3 + 1/5 +...upto N terms
body: <p>I was recently asked this question in a programming test. I can't seem to understand why I am getting the answer '1'. I am a beginner in the <code>C</code> programming language.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  int main()
  {
      float c = 0;
      int n, i = 1;
      printf("Enter the number here: ");
      n = getchar();
      while (i &lt;= 2*n - 1)
      {
          c = c + (1/i);
          i = i + 2;
      }
      printf("%f", c);
  }
  </code></pre>
  
  <p>I have already tried using a <code>for</code> loop, but the answer remains the same. Any help would be appreciated!</p>