Question: java language please Problem #4: [20 pts] Write a method void predecessor(int[A) that takes an array of integers as parameter and replaces even numbers with

java language please Problem #4: [20 pts] Write a method void predecessor(int[A)java language please

Problem #4: [20 pts] Write a method void predecessor(int[A) that takes an array of integers as parameter and replaces even numbers with their predecessors value. For example, the predecessor of 4 is 3. The predecessor of 8 is 7 and so. Write the program that asks the user to enter the array size, then the elements of the array and invokes the method. Your program should output the new content of the array. Sample run 1 Enter the length of the array: 5 Enter the elements of the array: 3 1 4 27 The output is 3 1 3 1 7 Sample run 2 Enter the length of the array: 8 Enter the elements of the array: 36 5 0 2 8 9 1 The output is 35 5 -1 1791

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!