C PROGRAMMING

write a c program to reverse the elements of an array

C program to reverse the elements of an array

  #include <stdio.h>

main()
{
int n, loop, a[100];
printf("Enter the number of elements in arrayn");
scanf("%d", &n);
printf("Enter array elementsn");
for (loop = 0; loop < n ; loop++)
scanf("%d", &a[loop]);
printf("The array after reversal:n");
for(loop=n-1;loop>=0;loop--)
{
printf("%d", a[loop]);
}
getch();
}
Show More

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button