Basic Arrays 0

Create an array that can hold ten integers. Fill up each slot of the array with consecutive prime numbers. Then display the contents of the array on the screen.

You must put the values in the array slots one line at a time and print them on the screen one slot at a time.

Do not use a loop and do not use an initializer list. Also, do not use any variable for the index; you must use literal numbers to refer to each slot.

This program will be at least 21 lines long.

Slot 0 contains 2
Slot 1 contains 3
Slot 2 contains 5
Slot 3 contains 7
Slot 4 contains 11
Slot 5 contains 13
Slot 6 contains 17
Slot 7 contains 19
Slot 8 contains 23
Slot 9 contains 29

©2003–2016 Graham Mitchell

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