program to enter some elements and display that in opposite order.

//array program to input elements and to display them in reverse order
  void main()
  int arr[100];      // array declaration with maximum size 100
  int size;     // size to be used to input elements
  int i;            //variable declaration
  printf("enter size of elements \n");//displays message
  scanf("%d",&size);                  //gets input for array size
   {                            //loop execution
     printf("enter elements\n");//displays message
     scanf("%d",&arr[i]);      //gets input for  array entered by user

   printf("elements, in reverse order, are\n");
   printf("%d\n",arr[i]);       // displays  elements

1)declare an array of  partiular size.
2)input elements for this using loop.
3)to display, use loop from given size-1 to 0 location (look above)
that's all
more, u can understand from side by description given in program
screen shot


No comments:

Post a Comment