Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

Why c is called a mid level programming language?

1019


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

1883


What is array in C

1098


What is the purpose of macro in C language?

1063


How many levels of indirection in pointers can you have in a single declaration?

1025


typedef struct{ char *; nodeptr next; } * nodeptr ; What does nodeptr stand for?

1583


What are # preprocessor operator in c?

1042


What is FIFO?

1538


Difference between Function to pointer and pointer to function

1015


Can we increase size of array in c?

917


What is the Purpose of 'extern' keyword in a function declaration?

1030


What is union and structure?

1037


What are the basic data types associated with c?

1218


What is the benefit of using #define to declare a constant?

1042


What are global variables?

1112