Explanation of Solution
Loop to read ten numbers and display them in opposite order:
Consider the below loop that reads ten numbers and a second loop that displays them in the opposite order from which they were entered:
//declaring in as an object of scanner class
Scanner in = new Scanner(System.in);
//declare and initialize the array
int[] myNumbers = new int[10];
/*the first loop stores all the ten numbers that we enter into an array */
for (int i = 0; i < myNumbers.length; i++)
{
//Prompt the user to enter a number
System.out.println("Enter a number: ");
//gets the next integer and store in the array
myNumbers[i] = in.nextInt();
}
/* the second loop displays the ten numbers in opposite order */
for (int j = myNumbers...
Want to see the full answer?
Check out a sample textbook solutionChapter 6 Solutions
BIG JAVA: LATE OBJECTS
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education