Associated Course(s):
Fundamentals of Programming with C

Given an array Arr[] of N integers, write a program to find the sum of values of even and odd index positions separately.

**Input: **

First line of input contains a single integer T which denotes the number of test cases. Then T test cases follows. First line of each test case contains a single integer N which denotes the number of elements in the array. Second line of each test case contains N space separated integer which denotes the elements of the array.

**Output:**

For each test case, in first line print the sum of elements of array present at even indexes and in the second line print the sum of elements at odd indexes.

**Constraints:**

1<=T<=100

1<=N<=1000

1<=Arr[i]<=10^{5}

**Example:
Input:**

2

6

1 2 3 4 5 6

7

10 20 30 40 50 60 70

9

12

160

120

Author: harsh.agarwal0

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.

sabka_din_aayega | 309 |

maggiiiii | 230 |

Anugrah_kumar | 172 |

UtkarshMalik | 150 |

Savage_19 | 146 |

Bishnu Dev Panda | 777 |

sabka_din_aayega | 620 |

Anugrah_kumar | 562 |

okayboss | 552 |

yk12 | 514 |

blackshadows | 5331 |

Ibrahim Nash | 5219 |

akhayrutdinov | 5111 |

mb1973 | 4925 |

Quandray | 4547 |

Login to report an issue on this page.