Write a recursive function which takes an array as input, an…

Write a recursive function which takes an array as input, and prints the values of the inputs in pairs. The last line of output should contain both the first and last values from the array; the second-to-last line should contain the second and second-to-last, etc. (If the number of elements in the array is odd, then do not print the one in the middle.) Example:     INPUT: [ 1,2,3,4,5 ]     OUTPUT:        2 4        1 5