Write code that fills an array double values[10] with each set of values below.
a) 1 2 3 4 5 6 7 8 9 10
b) 0 2 4 6 8 10 12 14 16 18
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 1 of 7
a) 1 2 3 4 5 6 7 8 9 10 for this loop i is started from 0 and ended when the value of i is smaller to the10 and inside the for loop the value i should be equal to . Here when value of i is 0 it is incremented by 1 so value of i should be equal to 1 then 2 up to 9 index is should be incremented. Because index started from 0 so at index 0 value 1 is present and at the 9 index value 10 is present. So code for this is:
for(int i=0;i<10;i++)
{
value[i]=i+1;
}