@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 <sourabhd2...@gmail.com> 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 <atul.87fri...@gmail.com> 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.