To be able to use arrays and iterate through them in Java.
For this lab exercise, you are to write a program that reads in a number of
positive integers from the user, stores them in an array, and prints them out
in the reverse order. The user will enter the numbers one on each line and
will use -1 to mark the end. The user will never enter more than 100 numbers.
- You should create an array to hold the numbers.
- You should read in the numbers using a Scanner inside of a loop.
- You should stop the loop when the user enters a value of -1.
- You should loop through the array backwards printing each value.
- Do not print the -1 value or any unused areas of the array.
Enter values (-1 to stop)
Your values, reversed:
When your program works, email the code to email@example.com.
Ian Finlayson | Licensed under a Creative Commons Attribution 4.0 International License.