Connect with a community of experts and enthusiasts on IDNLearn.com. Our platform provides prompt, accurate answers from experts ready to assist you with any question you may have.

Write a for loop that sets each array element in bonusscores to the sum of itself and the next element, except for the last element which stays the same. Be careful not to index beyond the last element.