Given an array **A** of size **N**, construct a Sum Array **S**(of same size) such that** **S is equal to the sum of all the elements of **A** except A[i]. Your task is to complete the function **SumArray(A, N)** which accepts the array A and N(size of array).

**Input :**

The first line of input is the number of testcases **T**. Each of the test case contains two lines. The first line of which is an integer N(size of array). The second line contains N space separated integers.

**Output :**

For each test case print the sum array in new line.

**User Task:**

Since this is a functional problem you did not have to worry about the input and output. You just have to complete the function **SumArray() **by storing arr[i]=S-arr[i]

**Constraint :**

1 <= T <= 10

1 <= N <= 10^{4}

1 <= A_{i} <= 10^{4}

**Example:
Input:**

2

5

3 6 4 8 9

6

4 5 7 3 10 1

**Output:**

27 24 26 22 21

26 25 23 27 20 29

**Explanation:
Testcase 1:** For the sum array S, at i=0 we have 6+4+8+9. At i=1, 3+4+8+9. At i=2, we have 3+6+8+9. At i=3, we have 3+6+4+9. At i = 4, we have 3+6+4+8. So S is 27 24 26 22 21.

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.

thanuvinu94 | 238 |

the_coder95 | 215 |

ShivayLamba | 208 |

sandeep.prajapati | 129 |

adityasuman2025 | 111 |

the_coder95 | 1441 |

RishabhTanwar1 | 1110 |

thanuvinu94 | 914 |

tathagat289 | 668 |

themanhasnoname | 620 |

blackshadows | 5331 |

Ibrahim Nash | 5219 |

akhayrutdinov | 5111 |

mb1973 | 4897 |

Quandray | 4547 |

Login to report an issue on this page.