0

Hello everyone! I write a code and now I don't know if is possible to make it right on my way.

https://code.sololearn.com/cnpbD6saPmF9/?ref=app Left wing of array is ok, but right wing is not ok, as I aspect.

16th Jul 2021, 6:29 PM
TeaserCode
5 Antworten
+ 1
Martin I know it, I just don't know how to make else part of the code right so that it will print elements in ascending format. Obviously there is something wrong with for loop with k-control variable who doesn't have affect on else statement.
17th Jul 2021, 3:37 AM
TeaserCode
+ 1
The code is poorly formatted which makes it hard to read. Try the following changes and see if it is what you intended. Comment out Line 22 (//continue). Change line 25 from    for(int k=n/2+i+1; k<n; k++){ To    for(int k=i+1; k<n; k++){ Change line 34 from    while(i>n/2); To    while(i<n);
17th Jul 2021, 5:53 AM
Brian
Brian - avatar
+ 1
I get it finally.
17th Jul 2021, 6:44 AM
TeaserCode
0
In the second for loop , check the value of k again
16th Jul 2021, 7:21 PM
Abhay
Abhay - avatar
0
How to check with one more for loop or if condition
16th Jul 2021, 7:29 PM
TeaserCode