Hi,
I'm trying to reverse the ordering of number.
I'm given an array of size.. say, 5. WITHIN a do-while loop, I must iterate from element 0 to 4.
For example, if the element contains ["Apple", "Banana", "Cow", "Dog", "Egg"], the output of the do-while loop has to be:
Apple Banana Cow Dog Egg
I have tried (in C#):
int numOfElements = array.Count; //Number of elements.
do
{
TextBox.Text += array[numOfElements-1] + " ";
numOfElements--;
}
while (numOfElements != 0);
...but obviously this will print out "Egg Dog Cow Banana Apple", which is the reverse order of what I'm tring to achieve.
So how can I make it print it in the correct order, within the Do-While loop? Some mathematical work involved in my opinion...?
Thank you!