Question: Write a C + + function called goodArray that takes a reference to an integer array called arr and does the following: Prints Good if
Write a function called goodArray that takes a reference to an integer array called arr and does the following:
Prints "Good" if there is an element in the array, called "BigNumber," whose value equals the sum of all even elements excluding itself
Prints "VeryGood" if you can swap the "BigNumber" with any other element to make the array a palindrome if the array is printed from left to right or printed from right to left the result is the same
Otherwise, prints NO
For example:
For the array arr the output is "Good" because arr is equal to the sum of all even elements arrarrarr
For the array arr the output is "VeryGood" because arr is equal to the sum of all even elements. Additionally, swapping it with arr makes the array a palindrome.
For the array arr the output is because there is no BigNumber.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
