##### A Very Big Sum

You are given an array of integers of size N. You need to print the sum of the elements in the array, keeping in mind that some of those integers may be quite large.

Input Format

The first line of the input consists of an integer N. The next line contains N space-separated integers contained in the array.

Output Format

Print a single value equal to the sum of the elements in the array.

Constraints

1<=N<=10
0<=A[i]<=10^4
Sample Input
5
1000000001 1000000002 1000000003 1000000004 1000000005
Output
5000000015
Note:
The range of the 32-bit integer is (-2)^31 to 2^31 or -2147483648 to 2147483647.
When we add several integer values, the resulting sum might exceed the above range. You might need to use long long int in C/C++ or long data type in Java to store such sums.

```
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
int main() {
/* Enter your code here. Read input from STDIN. Print output to STDOUT */
int n,i=0,a;
long long int sum=0;
scanf(“%d”,&n);
while(i<n){
scanf(“%d”,&a);
sum=sum+a;
i=i+1;
}
printf(“%llu”,sum);
return 0;
}
```

Competitive coding

Hackerrank problem

###### According to Armmbed.com

Integer Types (int, long and long long)

Page last updated 09 Jan 2010, by Daniel Peter. 5 replies

If you are curious about the integer types in the mbed compiler, I have copied a test program IntegerTypes from http://home.att.net/~jackklein/c/inttypes.html and the output is as follows:

Size of Boolean type is 1 byte(s)

Number of bits in a character: 8

Size of character types is 1 byte

Signed char min: -128 max: 127

Unsigned char min: 0 max: 255

Default char is unsigned

Size of short int types is 2 bytes

Signed short min: -32768 max: 32767

Unsigned short min: 0 max: 65535

Size of int types is 4 bytes

Signed int min: -2147483648 max: 2147483647

Unsigned int min: 0 max: 4294967295

Size of long int types is 4 bytes

Signed long min: -2147483648 max: 2147483647

Unsigned long min: 0 max: 4294967295

Size of long long types is 8 bytes

Signed long long min: -9223372036854775808 max: 9223372036854775807

Unsigned long long min: 0 max: 18446744073709551615

Note that int and long are the same size and if you want a 64 bit integer then you need to use long long (or unsigned long long).

## One comment: On A Very Big Sum Hackerrank Problem coderinme

Anonymousthanks a lot