0

In this question, swap first element with nth, 2nd element with n-1 and so on. Don't make it complicated, just for loops

#include<iostream> using namespace std; int main() { int temp; int arr[]={2,4,6,8,10,395,49} int n=sizeof(arr)/sizeof(arr[0]); for(int i=0;i<n/2,i++) { temp=arr[i]; arr[i]=n-i; cout<<arr[i]<<","; } }

31st Dec 2020, 8:37 AM
Muhammad Ali Zulfiqar
Muhammad Ali Zulfiqar - avatar
7 Réponses
+ 4
Muhammad Ali Zulfiqar Are you asking for help or giving assignment?
31st Dec 2020, 8:53 AM
A͢J
A͢J - avatar
+ 2
Ok..thanks
31st Dec 2020, 10:00 AM
Muhammad Ali Zulfiqar
Muhammad Ali Zulfiqar - avatar
0
Martin Taylor can't we do it without void? I haven't any experience with void
31st Dec 2020, 9:47 AM
Muhammad Ali Zulfiqar
Muhammad Ali Zulfiqar - avatar
0
Martin Taylor This is old version..I know C++..I am trying, I will do it
31st Dec 2020, 9:57 AM
Muhammad Ali Zulfiqar
Muhammad Ali Zulfiqar - avatar