write a program to display the array elements in reverse
order in c language
Answer Posted / prajot chougale
#include<stdio.h>
main()
{
int n, c, d, a[100], b[100];
printf("Enter the number of elements in array\n");
scanf("%d",&n);
printf("Enter the array elements\n");
for ( c = 0 ; c < n ; c++ )
scanf("%d",&a[c]);
for ( c = n - 1, d = 0 ; c >= 0 ; c--, d++ )
b[d] = a[c];
for ( c = 0 ; c < n ; c++ )
a[c] = b[c];
printf("Reverse array is\n");
for( c = 0 ; c < n ; c++ )
printf("%d\n", a[c]);
return 0;
}
Is This Answer Correct ? | 5 Yes | 4 No |
Post New Answer View All Answers
What is size of union in c?
Which is more efficient, a switch statement or an if else chain?
Differentiate between calloc and malloc.
Can you please explain the difference between strcpy() and memcpy() function?
What is difference between arrays and pointers?
if the area was hit by a virus and so the decrease in the population because of death was x/3 and the migration from other places increased a population by 2x then annually it had so many ppl. find our the population in the starting.
What is #pragma statements?
What is structure padding in c?
What is the meaning of c in c language?
How can you allocate arrays or structures bigger than 64K?
What is the size of empty structure in c?
What is binary tree in c?
What is the basic structure of c?
What are type modifiers in c?
What is the best way to store flag values in a program?