Display array in reverse order

 Array in reverse order


C Program
#include <stdio.h>
#include <stdlib.h>
int main()
{
    int n,i;
    printf("Enter the size of the array:");
    scanf("%d",&n);
     int array[n];
    for(i=1;i<=n;i++)
    {
        printf("Enter Element %d: ",i);
        scanf("%d",&array[i]);
    }
    printf("Array in Reverse order is:\n");
     for(i=n; i>0; i--)
    {
        printf("%d ",array[i]);
    }
}

1 comment:

  1. This comment has been removed by a blog administrator.

    ReplyDelete