Labs

  1. Write a program that declares an array of five integers, int[] numbers = { 28, 33, 55, 21, 35 };. Use a for loop to determine the smallest and largest number in the array, and print them.

(Solution: MinMaxFor.java)

  1. Rewrite your solution to 1 to use a foreach loop.

(Solution: MinMaxForEach.java)

  1. Rewrite your solution to 1 to use a while loop.

(Solution: MinMaxWhile.java)

  1. Modify your solution to 2 to prompt the user for the five values to store in the array.

(Solution: MinMaxPrompt.java)

  1. (Optional) Write a program to print the reverse of any integer value. For example, for the integer 123, the program should print 321.

(Solution: Reverse.java)


Prev -- Up