Given an array of n integers find the sum of all the elements of the array.
Note: the elements of the array might be large.
Input format
First line contains integer t ,denoting the number of testcases.
For each testcase:
First line contains an integer n.
Second line contains n space separated integers.
Output format
For each testcase print the sum of all the array elements on a new line.
For each test case, initialise sum = 0;
While iterating through the array, do sum = sum + arr[i] that is add the current array element to the sum counter.
For large values, use ‘long long’ in C++ instead of ‘int’.
As array contains values which can’t be handled by even Unsigned Long Long Int
So u can try using Boost Library in C++ . You can read about it from here
Do you know how to implement a number as a array such that each of its element is a single digit of that number?
Once you can do that, just simulate addition.
Accept all numbers as strings (of size at most 100), and add all the strings , code to add 2 numeric strings and you are done : Sum of two large numbers - GeeksforGeeks