@atul.. It seems that in the example explained above i have done it correctly but while jolting down the code i messed up the indexing..
Thanks for bringing it up .. :) On 31 Dec, 16:17, Lucifer <[email protected]> wrote: > @atul.. > > Yes, A[i] += A[i+1] is correct.. > > Another correction that is required is : > > for (int i = 7; i >= 0 ; --i) // earlier for (int i = *8*; i > 0 ; -- > i) > > On 31 Dec, 16:10, Lucifer <[email protected]> wrote: > > > > > > > > > @atul > > > There is no. correction.. > > The for loop is correct.. It should be: > > > for (int i =0; i< 9; ++i) > > > On 31 Dec, 16:02, atul anand <[email protected]> wrote: > > > > correction in Lucifier code :- > > > > if (N > 1) > > > { > > > int iter = 0; > > > int totalCount = 10; // this is when N = 1 ... > > > > for (int i=0; i <= 9; ++i) // earlier for (int i=0; i *<* 9; ++i) > > > A[i] = 1; > > > > while(++iter < N) > > > { > > > for (int i = 8; i > 0 ; --i) > > > { > > > A[i]+= A[i+1]; // earlier A[i]+= A*[i-1]** * > > > totalCount +=A[i]; > > > } > > > totalCount+=1; > > > } > > > printf("%d", totalCount);} > > > > else > > > printf("%d", N==1 ? 10 : 0); -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
