C Program to copy the contents of one array into another in the reverse order.

/* C Program to copy the contents of one array into another in the reverse order */
#include<stdio.h>
int main()
{
	int a[10], b[10], i, j;
	printf("\nEnter 10 Elements : ");
	for (i = 0; i<10; i++)
	{
		scanf("%d", &a[i]);
	}
	for (i = 0, j = 9; i<10; i++, j--)
	{
		b[i] = a[j];
	}
	printf("\nArray after Copying in Reverse Order : ");
	for (i = 0; i<10; i++)
	{
		printf("%d ", b[i]);
	}
	return 0;
}

Output :
Enter 10 Elements : 10
20
30
40
50
60
70
80
90
100

Array after Copying in Reverse Order : 100 90 80 70 60 50 40 30 20 10



Leave a comment