Program for reverse the array elements in c language.

#include<stdio.h>
#include<conio.h>
void main()
{
 int arr[10],rev[10];
 int i,p,j;
 clrscr();
 printf("enter a array elements =");
 for(i=0; i<10; i++)
 {
 scanf("%d",&arr[i]);
 }
 printf("\narray elements are =");
 for(i=0; i<10; i++)
 {
 printf("%d ",arr[i]);
 }
 for(i=9; i>=0; i--)
 {
  rev[j++]=arr[i];
 }
 printf("\nthe reverse elements of array are =");
 for(j=0; j<10; j++)
 {
 printf("%d ", rev[j]);
 }
 getch();
}
■》 Output->

enter a array elements =1
2
3
4
5
6
7
8
9
0

array elements are =>
 1 2 3 4 5 6 7 8 9 0

the reverse elements of array are=>
 0 9 8 7 6 5 4 3 2 1

Comments

Popular posts from this blog

Introduction of java Programming language.

Stack data structure.