You are viewing a single comment's thread. Return to all comments →
You have an array index out of bounds in u r code at line 24 because of negative index. Also, add a condition that if length is 1 display YES.
for( int i = 0 ; i < n ; i++)
lc += a[i-1];
Cheers. Good Day.