Basic Arrays 2

Create an array that can hold ten integers. Fill up each slot of the array with a random number from 1 to 100. Then display the contents of the array on the screen. You must use a loop.

And, like last time, you must use the length field of your array and not a literal number (like 10) in the condition of the loop.

Slot 0 contains a 45
Slot 1 contains a 87
Slot 2 contains a 39
Slot 3 contains a 32
Slot 4 contains a 93
Slot 5 contains a 86
Slot 6 contains a 12
Slot 7 contains a 44
Slot 8 contains a 75
Slot 9 contains a 50

©2014 Graham Mitchell

This assignment is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States License.
Creative Commons License