Labs
- Write a program that declares an array of five integers,
int[] numbers = { 28, 33, 55, 21, 35 };. Use aforloop to determine the smallest and largest number in the array, and print them.
(Solution: MinMaxFor.java)
- Rewrite your solution to 1 to use a foreach loop.
(Solution: MinMaxForEach.java)
- Rewrite your solution to 1 to use a
whileloop.
(Solution: MinMaxWhile.java)
- Modify your solution to 2 to prompt the user for the five values to store in the array.
(Solution: MinMaxPrompt.java)
- (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)