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 the benefit of using an enum rather than a #define constant?
Hai sir, I had planned to write the NIC scientific engineer exam , plz post the sample question......
Can we increase size of array in c?
A c program to display count values from 0 to 100 and flash each digit for a secong.reset the counter after it reaches 100.use for loop,. pls guys hepl me.. :(
Why are algorithms important in c program?
How to get string length of given string in c?
What is the use of pragma in embedded c?
hi... can anyone help me to make a two-dimensinal arrays in finding the sum of two elements plzzz. thnx a lot...
A collection of functions,calls,subroutines or other data a) library b) header files c) set of files d) textfiles
What is memcpy() function?
Compare array data type to pointer data type
Do array subscripts always start with zero?
Hello. How to write a C program to check and display president party like if i type in the console "biden" and hit enter the output shoud be : "biden is democrat" and if i type "trump" and hit enter the output shoud be: "trump is republican"
Give basis knowledge of web designing ...
Explain Basic concepts of C language?