Question #301187

The student detail of mark statement of one array to be copied into another array. The order of mark statement of second array should be opposite to those of first array. Write a C program to copy one array into another array using pointers.



Sample Testcase


Input :


5


15


25


35


45


55


Output :


55


45


35


25


15

Expert's answer

#include <stdio.h>

int n;
int marks[100];
int oppos[100];

int main() {
  cin >> n;
  for (int i=0; i<n; i++) {
    cin >> marks[i];
    oppos[n-1-i]=marks[i];
  }
  for (int i=0; i<n; i++) {
    cout << oppos[i] << endl;
  }
  return 0;
}
LATEST TUTORIALS
APPROVED BY CLIENTS