Creating an array

From Progzoo
Jump to: navigation, search

In these programs you are given the size of the array. You must create and return an array as specified.

All values are 10

Create an array of size n. Set every element to 10


[Font] [Default] [Show] [Resize] [History] [Profile]

All values are the length of the array

Set every element to n


[Font] [Default] [Show] [Resize] [History] [Profile]

Set to 0, 1, 2, 3, ...

Create an array where element 0 is 0, element 1 is 1 and so forth...


[Font] [Default] [Show] [Resize] [History] [Profile]

Set to 1, 2, 3, ...

Create an array where element 0 is 1, element 1 is 2 and so forth...


[Font] [Default] [Show] [Resize] [History] [Profile]


Create an array that is twice the size of n

You should make the array twice the size of n. Make every element 2.


[Font] [Default] [Show] [Resize] [History] [Profile]