On Jun 28, 2011, at 8:20 PM, Bhinderwala, Shoeb wrote: > The inputs are two arrays of type double of the same length – dailyValues and > totalValues. The output is the array contrib of the same length. > > > int n = dailyValues.length; > > for (int i = 0; i < n; i++) > > { > > sum = 1.0; > > for (int j = i + 1; j < n; j++) > > { > > sum *= (1.0 + (totalValues[j] / 100.0)); > > } > > contrib[i] = sum * dailyValues[i]; > > } >
1. Are you sure that this does what you want it to? 2. What does it do? There are two obvious red flags with the code: -You have a variable called 'sum' which is really a product. -You never use index 0 of totalValues Have all good days, David Sletten -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en