1. Write a program that asks the user the size and the elements of the array. The program should display the reverse of the array.

Example:

INPUT output
Enter the List The list
10 10 20 30 40 50
20
30 The inverse of the list
40 50 40 30 20 10
50

The example you posted doesn't make any sense to me. If you input 5 numbers 1 2 3 4 5 the inverse is 5 4 3 2 1, is that what you want?

To make it easy and simple.
1st you must declare an array of ints, having known its size, like:

int array [5];

2nd you must introduce items into the array, by parshing through it and assigning each element to corresponding position in the array. Say, you have an array of 5 items, you have also those 5 items: 12,43,15,652,231, all you have to do is to asign items to the array.

array[0]=12;

3rd get the reverse of the list by printing the list in reverse order, as this:

//by knowing its size of 5:
for (int i=5;i--;){
    //print your array;
}

for (int i=5;i--;){

I know what you mean, but it would be better to make a standard loop that newbe can understand and that us oldies don't have to think very much about (our thinking power is somewhat diminished)

for(int i = 4; i >= 0; i--)

Yes :) you could make it more visible that way...
Kinda ironic this example, since I've tried to make it an easy example. Indeed, that makes the looping more visible.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.