title: Alternating factorial terms using Java
body: <p>I'm trying to write a loop in Java that can output the sum of a series which has this form... 1! -3! + 5! – 7! + ... up to n (user gives n as a positive odd number). For example, if the user inputs 5 for n, then the series should calculate the sum of 1! -3! + 5! (hard part) &amp; display it to the user with a basic print statement (easy part). If the user gives 9, then the sum calculated would come from 1! -3! + 5! - 7! + 9!.</p>
  
  <p><strong>For ease, just assume the user always puts in a positive odd number at any time. I'm just concerned about trying to make a sum using a loop for now.</strong></p>
  
  <p>The closest code I've come up with to do this...</p>
  
  <pre><code>int counter = 1;
  int prod = 1;   
  n = console.nextInt(); 
  while (counter &lt;= n) 
  {                  
      prod = prod * counter;
      counter++; 
  }   
  System.out.println(prod);
  </code></pre>
  
  <p>This does n!, but I'm finding it hard to get it do as specified. Any pointers would be great.</p>