My code has a bug. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

My code has a bug.

I’m trying To fix the sorting https://code.sololearn.com/c2kBw11ORVJF/?ref=app

9th Mar 2020, 2:41 AM
Microne mafika
Microne mafika - avatar
1 Answer
+ 2
In your loops use this, otherwise you get out of range: for(int i=0; i< li.Count -1; i++) { for(int j = 0; j<li.Count -1; j++) and: temp =li[j]; // it should be li[j] li[j]=li[j+1]; li[j+1]=temp;
9th Mar 2020, 6:55 AM
Paul
Paul - avatar