title: Calculating the product of all the odd numbers
body: <p>So I am trying to create a script that calculates the product of all the odd numbers from 1 to 1000 (using MATLAB).  The program runs but the product is not correct:
  %Program is meant to calculate the product of all the odd numbers from 1 to 1000</p>
  
  <pre><code>% declare variable ‘product’ as zero
  
  product = 0.;
  
  % initialize counter, ‘n’, to 1000
  
  n = 1000;
  
  for i = 1:2:n
  
  product = product + i;
  
  end
  
  fprintf('The product of all the odd numbers from 1 to %d is %d\n', n, product) 
  </code></pre>
  
  <p>So I'm not really sure how to go about this and am looking for some guidance. Thanks!</p>