Question: 6.1 : Carry out the following tasks with an array ( NOTE : when you program this, be sure to do each of them one
6.1 : Carry out the following tasks with an array (NOTE: when you program this, be sure to do each of them one after the other in your code) a. Allocate an array named a of ten integers. b. Put the number 17 as the initial element of the array. c. Put the number 29 as the last element of the array. d. Fill the remaining elements with -1. e. Add 1 to each element of the array. f. Print all elements of the array, one per line. g. Print all elements of the array in a single line, separated by commas.
6.2 : Write code that fills an array named values with each set of numbers below. (NOTE: you may NOT simply initialize the array to begin with all of the values or add them one by one, unless there is no discernible pattern or the array already initializes to that value - which as a hint, there is only one array present for each of those properties. You must fill the array by using your understanding of the pattern presented to add the correct element at the correct position - iteration and at times selection will likely help you) a. 1 2 3 4 5 6 7 8 9 10 b. 0 2 4 6 8 10 12 14 16 18 20 c. 1 4 9 16 25 36 49 64 81 100 d. 0 0 0 0 0 0 0 0 0 0 e. 1 4 9 16 9 7 4 9 11 f. 0 1 0 1 0 1 0 1 0 1 g. 0 1 2 3 4 0 1 2 3 4
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
