You are given an array A of size N. You need to print elements of A in alternate order.
The first line of input contains T denoting the number of testcases. T testcases follow. Each test case contains two lines of input. The first line contains N and the second line contains the elements of the array.
For each testcase, print the alternate elements of the array(starting from index 0).
Since this is a function problem, you just need to complete the provided function void print(int ar,int n)
1 <= T <= 200
1 <= N <= 105
1 <= Ai <= 105
1 2 3 4
1 2 3 4 5
1 3 5
Testcase1: print 1, then 3.
Testcase2: print 1, then 3, then 5.
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.