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 / s r samanta

#include<iostream>
using namespace std;
int main()
{
int n, c, j, temp, a[100];

cout<<"Enter the number of elements in array\n";
cin>>n;

cout<<"Enter the array elements\n";

for ( c = 0 ; c < n ; c++ )
cin>>a[c];

if( n%2 == 0 )
c = n/2 - 1;
else
c = n/2;

for ( j = 0 ; j < c ; j++ )
{
temp = a[j];
a[j] = a[n -j - 1];
a[n-j-1] = temp;
}


cout<<"Reverse arry\n";
for( c = 0 ; c < n ; c++ )
cout<<"\n"<< a[c];


return 0;
}

Is This Answer Correct ?    1 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the package for freshers(Non IIT) in amazon(hyderabad). And what is the same for those who are a contract employee.

4251


What is a pointer on a pointer in c programming language?

1096


What are types of functions?

981


why programs in c are running with out #include? some warnings are display in terminal but we execute the program we get answer why? eg: main() { printf("hello world "); }

1715


What is scanf_s in c?

1072


write a program fibonacci series and palindrome program in c

983


what is the difference between class and unio?

2308


What is the description for syntax errors?

1103


How will you print TATA alone from TATA POWER using string copy and concate commands in C?

1330


Explain how can you restore a redirected standard stream?

1045


Explain Basic concepts of C language?

1086


What is the difference between call by value and call by reference in c?

1122


What would happen to X in this expression: X += 15; (assuming the value of X is 5)

1891


can anyone suggest some site name..where i can get some good data structure puzzles???

2032


What is the right type to use for boolean values in c?

997