Hello **Programmers/Coders,** Today we are going to share ** solutions of Programming problems of HackerRank, Algorithm Solutions of Problem Solving Section in Java**. At Each Problem with Successful submission with

**all Test Cases Passed,**you will get an score or marks. And after solving maximum problems, you will be getting stars. This will highlight your profile to the recruiters.

In this post, you will find the solution for **A Very Big Sum** **in Java-HackerRank Problem**. We are providing the **correct and tested solutions** of coding problems present on **HackerRank**. If you are not able to solve any problem, then you can take help from our Blog/website.

Use “Ctrl+F” To Find Any Questions Answer. & For Mobile User, You Just Need To Click On Three dots In Your Browser & You Will Get A “Find” Option There. Use These Option to Get Any Random Questions Answer.

**Introduction To Algorithm**

The word **Algorithm** means “a process or set of rules to be followed in calculations or other problem-solving operations”. Therefore Algorithm refers to a set of rules/instructions that step-by-step define how a work is to be executed upon in order to get the expected results.

**Advantages of Algorithms:**

- It is easy to understand.
- Algorithm is a step-wise representation of a solution to a given problem.
- In Algorithm the problem is broken down into smaller pieces or steps hence, it is easier for the programmer to convert it into an actual program.

** Link for the Problem** – A Very Big Sum– Hacker Rank Solution

A Very Big Sum – Hacker Rank Solution

**Problem:**

In this challenge, you are required to calculate and print the sum of the elements in an array, keeping in mind that some of those integers may be quite large.

**Function Description**

Complete the *aVeryBigSum* function in the editor below. It must return the sum of all array elements.

aVeryBigSum has the following parameter(s):

*int ar[n]*: an array of integers .

**Return**

*long*: the sum of all array elements

**Input Format**

The first line of the input consists of an integer .

The next line contains space-separated integers contained in the array.

**Output Format**

Return the integer sum of the elements in the array.

**Constraints**

**Sample Input**

5 1000000001 1000000002 1000000003 1000000004 1000000005

**Output**

5000000015

**Note:**

The range of the 32-bit integer is

.When we add several integer values, the resulting sum might exceed the above range. You might need to use long int C/C++/Java to store such sums.

A Very Big Sum– Hacker Rank Solution

import java.util.Scanner; /** * @author Techno-RJ * */ public class AVeryBigSum { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); long sum = 0; for (int arr_i = 0; arr_i < n; arr_i++) { sum += in.nextLong(); } System.out.println(sum); in.close(); } }