+ 1

Haven't solved.Why don't loop work upto the limit?

Why don't output shows upto N[20]? Why it shows upto N[11]? Explain the cause and debug it... Problem::Write a program that reads an array N [20]. After, change the first element by the last, the second element by the last but one, etc.., Up to change the 10th to the 11th. print the modified array. Input The input contains 20 integer numbers, positive or negative. Output For each position of the array N print "N[i] = Y", where i is the array position and Y is the number stored in that position. sample input:1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 sample output: N[0]=20 N[1]=19 . . N[18]=2 N[19]=1 https://code.sololearn.com/cZrPf59VCIRy/?ref=app&fbclid=IwAR3zUlyAPSqzw-_P7dmVE64WmWBHnmsoVbXcXXbh6HR77TYUOnDnF5nRHys

13th Apr 2022, 3:10 PM
KAZI FAISAL MAHMUD
KAZI FAISAL MAHMUD - avatar
11 ответов
+ 1
I'm not understanding the goal of the code. What was it supposed to do? An illustration of input, and expected output may help understanding, be great if you can show me that ...
13th Apr 2022, 3:31 PM
Ipang
+ 1
Kazi, Correct me if I'm wrong, but that looks like reversing the elements in array <N> Tell me if misunderstood it ...
13th Apr 2022, 3:47 PM
Ipang
+ 1
Okay Kazi, Now can you tell me what is the purpose of array <p> in the code, the one with 11 elements ...
13th Apr 2022, 3:55 PM
Ipang
+ 1
Kazi, I have this code which reads in array elements in reverse positioning. Idk whether it helps, but hopefully it gives you an idea. Otherwise I can only think of swapping elements from furthest outer ends down to the deeepest one. https://code.sololearn.com/cSD9HuxYxbhq/?ref=app
13th Apr 2022, 4:10 PM
Ipang
0
Jolen Mascarenhas Can you explain the cause? Without your answer will be removed by Solo learn.
13th Apr 2022, 3:30 PM
KAZI FAISAL MAHMUD
KAZI FAISAL MAHMUD - avatar
0
Ipang Problem:You will take 20 integer as input in a Array N[20].But you have to show output at N[0]='Value of N[19] N[1]=Value of N[18] . . . . . . . . N[18]=Value of N[1] N[19]= value of N[0]
13th Apr 2022, 3:37 PM
KAZI FAISAL MAHMUD
KAZI FAISAL MAHMUD - avatar
0
Ipang You are right.But I am clearifing more Question:Write a program that reads an array N [20]. After, change the first element by the last, the second element by the last but one, etc.., Up to change the 10th to the 11th. print the modified array. Input The input contains 20 integer numbers, positive or negative. Output For each position of the array N print "N[i] = Y", where i is the array position and Y is the number stored in that position.
13th Apr 2022, 3:51 PM
KAZI FAISAL MAHMUD
KAZI FAISAL MAHMUD - avatar
0
When I was trying with two variable array<i>,array<j> then array after array N<10> it was giving new assigned value of N<1> to <10>.To resolve it I used p
13th Apr 2022, 4:02 PM
KAZI FAISAL MAHMUD
KAZI FAISAL MAHMUD - avatar
0
In for statement, there is l=11 and so the confusion... Change it to 20
13th Apr 2022, 4:46 PM
Jolen Mascarenhas
0
I really don't understand fully arrays can I get a friend who has a little understanding 🙏
15th Apr 2022, 2:00 PM
Hemotions
Hemotions - avatar
13th Apr 2022, 3:17 PM
Jolen Mascarenhas