Answer to Question #301187 in C for Suvedhaa

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

1
Expert's answer
2022-02-22T16:31:19-0500
#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;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS