title: Returning the sum of 1+1/2+1/3+...+1/n Series
body: <p>I would like for you to help me correct the output on this method. The recursive version returns what I need, but the non_recursive version does not return the same result. Here is my code:</p>
  
  <pre><code>public static double sum_nr(int n){
      int result = 1;
      for(int i=n-1; i&gt;0; i--){
          result += 1/i;
      }
      return result;
  }
  
  public static void main(String[] args){
      Scanner scan = new Scanner(System.in);
      System.out.println("Is the string a palindrome or not? ");
      String test = scan.nextLine();
      System.out.println("Answer: " + isPalindrome_r(test));
      System.out.println("Answer: " + isPalindrome_nr(test));
      System.out.println("What is the sum of n number: ");
      int test2 = scan.nextInt();
      System.out.println("Answer: " + sum_r(test2));
      System.out.println("Answer: " + sum_nr(test2));
  }
  </code></pre>
  
  <p>Recursive version when <code>n = 10</code> is <code>1.6179775280898876</code></p>
  
  <p>Non-recursive version <code>n = 10</code> is <code>2.0</code></p>
  
  <p>I want these two to both match up. Can you help me?</p>