Practice Exercise 8
Arrays

Objective: To become familiar with array handling.


Exercise 1:

Write a program that creates an eight-element array of type integer, sets the elements to the first eight powers of 3, and then prints out those values. Use a for loop to set the values, and for variety, use a do while loop to display the values.


Exercise 2:

Write a program that reads eight integers from an input box into an array and then prints them out in reverse order.


Solution