I have a problem with an exercise on arrays. The question is this:
Create the code to populate the array with the following values: 3 4 7 12 19 28 39 52 67 84
I've done the other exercises on this list, my problem with this is in logic. I can not think of how to increment the counter so that it adds the next odd number. I even tried to elaborate as follows:
if((i+1)%2==0)
{
numero = numero+i;
contador= i;
}
else {
numero= numero+2;
contador = i;
}
But it did not. Any help ???