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
Why c is called a mid level programming language?
write a programe to accept any two number and check the following condition using goto state ment.if a>b,print a & find whether it is even or odd and then print.and a
What is array in C
What is the purpose of macro in C language?
How many levels of indirection in pointers can you have in a single declaration?
typedef struct{ char *; nodeptr next; } * nodeptr ; What does nodeptr stand for?
What are # preprocessor operator in c?
What is FIFO?
Difference between Function to pointer and pointer to function
Can we increase size of array in c?
What is the Purpose of 'extern' keyword in a function declaration?
What is union and structure?
What are the basic data types associated with c?
What is the benefit of using #define to declare a constant?
What are global variables?