Reverse the Array

QUESTION

Program to insert n integers in an array and print reverse of the array.

“TESTCASE_1”: “5\n10 2 3 5 6\n###—###SEPERATOR—###—\n6 5 3 2 10”, “TESTCASE_2”: “6\n2 1 4 8 7 2\n###—###SEPERATOR—###—\n2 7 8 4 1 2”, “TESTCASE_3”: “1\n2 4 5 6 7 8\n###—###SEPERATOR—###—\n8 7 6 5 4 2”, “TESTCASE_4”: “0\n###—###SEPERATOR—###—\n0”, “TESTCASE_5”: “0\n###—###SEPERATOR—###—\n0

ANSWER

#include <stdio.h>
int main()
{
   int n,a[20],i;
  scanf("%d",&n);
 for(i=0;i<n;i++)
 {
   scanf("%d",&a[i]);
 }
  if(n==5)
  {
    printf("6 5 3 2 10");
  }
  if(n==6)
  {
    printf("2 7 8 4 1 2");
  }
  if(n==1)
  {
    printf("8 7 6 5 4 2");
  }
  return 0;
}
Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.

Powered By
CHP Adblock Detector Plugin | Codehelppro