You are given n integers. Store the integers in an array and physically reverse the order of the integers in the array. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

You are given n integers. Store the integers in an array and physically reverse the order of the integers in the array.

help me please

9th Jul 2017, 2:51 AM
Joyanta Mondal
Joyanta Mondal - avatar
3 Answers
+ 1
Which step do you need help with? What have you tried?
9th Jul 2017, 3:06 AM
Igor B
Igor B - avatar
+ 1
Swap the values of first and last, then second and second last, and so on. if( n%2 == 0 ){ for(i=0;j<n/2;i++){ temp = a[i];. // some integer temp a[i] = a[n-i]; a[n-i] = temp; } } similarly write the else case.
9th Jul 2017, 3:37 AM
G.S.N.V. Suraj
G.S.N.V. Suraj - avatar
- 1
full body
9th Jul 2017, 3:17 AM
Joyanta Mondal
Joyanta Mondal - avatar