+ 1

this is working good beside when n<10.why?

If someone help me to get out the error 😬 When n <9 it works fine but for n>9 it doesn't show last value and first value diplayed on second index rather then first anyone tell me where is error? One thing to clarify its not my assignment or college work. Im just started Data structure. https://code.sololearn.com/cJOSBuwcD9kz/?ref=app https://code.sololearn.com/cJOSBuwcD9kz/?ref=app

25th Feb 2021, 3:59 PM
Samarendra Singh
Samarendra Singh - avatar
2 odpowiedzi
+ 4
The sorting method gets in its loop to big index. The solution is as follows: for(j=0;j<n-i-1;j++)
25th Feb 2021, 4:23 PM
JaScript
JaScript - avatar
0
One thing to add it works on sololearn but not in dev c++
25th Feb 2021, 4:08 PM
Samarendra Singh
Samarendra Singh - avatar