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
3 odpowiedzi
+ 1
Which step do you need help with? What have you tried?
+ 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.
- 1
full body