programming forums Java Java JSRs Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Products This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Sheriffs:
Saloon Keepers:
Bartenders:

# Array output question

Greenhorn
Posts: 5
can any of you guys help me doing this problem

Show the output of the array

the answer to that problem is 13 15 19 9
can anyone show me how to calculate this ? and how the answer come up to be 13 15 19 9 ?

thank you

Greenhorn
Posts: 20
The second element of the array + the third is 13. a[i] + a[i+1]. i is = 1, 1 = second element of array, not first. Work out the rest of the loop from there. ;)

Ranch Hand
Posts: 529
19
Output is 13 15 19 if you print a[i] in that loop. Please go through this image link if still has problem please ask.

Bartender
Posts: 585
9
• 1

Show the output of the array

I am not sure what is meant by this; an array does not "output".
After the loop is finished, if you print out the contents of the array you should get

3 13 15 19 9

Bartender
Posts: 10575
66

pierre val wrote:the answer to that problem is 13 15 19 9

No it isn't; as Fred already showed you.

The array starts with 5 elements, and it's not going to suddenly lose one because of what you're doing.

Winston

 Time is mother nature's way of keeping everything from happening at once. And this is a tiny ad: The WEB SERVICES and JAX-RS Course https://coderanch.com/t/690789/WEB-SERVICES-JAX-RS