Click here to Skip to main content
15,867,835 members

Comments by Benktesh Sharma (Top 28 by date)

Benktesh Sharma 13-Mar-20 6:40am View    
The question is only stating the problem in the index out of bound error. The original code intended to display first and every 10th after and so did the proposed solution.
Benktesh Sharma 12-Mar-20 16:13pm View    
The solution is correct to the extent that the assumption is re-stated. First and every 10th after that. Updated.
Benktesh Sharma 12-Mar-20 16:11pm View    
Did you intend to print every 10th including the first or excluding the first?
Benktesh Sharma 12-Mar-20 8:51am View    
I see. Thanks.
Benktesh Sharma 12-Mar-20 7:03am View    
@Nelek, the loop is printing the actual number in the array. The original code from the poster of the question intended to print 1st, 10th and so on. In addition, 'every 10th' implies first, tenth, twentieth and so one. You may be right in handling other edge conditions, but the original concern was 'index out of bound exception'.