Please solve it ASAP
it's urgent.
Write a complete Java program that provides a method named subtractPairs() that takes any array of integers as a parameter, replaces every 2 consecutive elements (starting from the right) with their difference and returns the array containing the sum values only. Assume number of elements is always even. Sample Output: Before: Left[5, 6, 6, 3, 3, 2, 2, 1]right After: Left[-1, -3, -1, -1]right Array size and elements should be read from the user.
Please solve it ASAP it's urgent.
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am