Question: Perform the following tasks for an array called fractions: a) Declare constant ArraySize initialized to 10. b) Declare variable fractions which will reference an array
Perform the following tasks for an array called fractions:
a) Declare constant ArraySize initialized to 10.
b) Declare variable fractions which will reference an array with ArraySize elements of type double. Initialize the elements to 0.
c) Name the element of the array with index 3.
d) Assign the value 1.667 to the array element with index 9.
e) Assign the value 3.333 to the array element with index 6.
f) Sum all the elements of the array, using a for statement. Declare integer variable x as a control variable for the loop.
g) Sum all the elements of the array, using a foreach statement. Declare double variable element as a control variable for the loop.
Step by Step Solution
3.43 Rating (162 Votes )
There are 3 Steps involved in it
a Constant ArraySize 10 b Verification new double... View full answer
Get step-by-step solutions from verified subject matter experts
