Question: Write a C + + function called goodArray that takes a reference to an integer array called ar and does the following: 1 . Prints
Write a C function called goodArray that takes a reference to an integer array called ar 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 an is equal to
the sum of all even elements ar an arr
For the array ar the output is "VeryGood" because an is
equal to the sum of all even elements. Additionally, swapping it with an makes the array a palindrome.
For the array arr the output is NO 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
