Sunday, 2 April 2017

Hacker Rank solution for A Very Big Sum in C++

Problem:- Solution of Hackerrank - a very big sum hackerrank solution c++ ora very big sum in java or a very big sum solution or a very big sum solution in C++ or a very big sum hacker rank solution in Java or a very big sum hacker rank solution c++ or a very big sum hacker rank solution c++ or a very big sum program in c or a very big sum solution in c or a very big sum hacker rank solution in python or a very big sum in java or a very big sum hacker rank solution in c or Hacker Rank Solution For a very big sum in C++ or a very big sum in C++ or Hacker Rank solution for a very big sum in C++.

Check This- Hacker rank Solution for C++ Sub Domain Introduction, Classes, STL, Inheritance.

Logic:- a very big sum is similar to an array sum or we can say that both problems are same the only title is different. The same logic applies first take an input from the user and store the input in an array after that take a long long int variable(Cause our array is integer type) and add the array elements and store in long size variable in the end print the sum. See below explanation part.

Explanation:- The size of sum variable should be big for the big size we are taking long long int sum. by using a For Loop add all elements of an array and print the sum. We can do this by using one Loop and By using separate Loops for Both storing elements and Sum of elements of an array.

for(int arr_i = 0;arr_i < n;arr_i++)
{
cin >> arr[arr_i];
sum+=arr[arr_i];
}

cout<<sum;


We got our solution of a problem.

Also check- Geeksforgeeks solution for School, Basic, Easy, Medium, Hard Domain.

Copy the full solution or colored code and paste into the hacker rank editor and click to Run Code if the code runs successfully then click to Submit Code. Before pasting the code into the editor make sure you have chosen c++ editor in the top right drop down option.

Submit your solution here:- Click here


Solution:-

#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;

Extreme Recommended:- Like our Facebook Page or Join our Facebook Group and Google plus Community for up-to-date. If you have any Query or Question you can ask in the group, I will Try To Solve your Query and try to answers of your Questions withing 24 Hours, You can also Email me or comment below Please suggest to your Friends to join and like our page and don't forget to Subscribe. Enter your Email and click to subscribe.

Ghanendra Yadav

Ghanendra Yadav

Hello, I Am Ghanendra Yadav Owner of This Blog, I am professional Blogger and Programmer. I Love Programming, Logo Making, And Banner Designing. My Highest Qualification is MCA From NIT Warangal. You Can Find Me On Social Media Through Below Link And If You Have Any Query Related To Programming And Other Subject Comment Below or You Can Mail Me I Will Try To Answer Within 24 Hours Email:- yghanendra@student.nitw.ac.in

Find me on Social Media

Facebook | Twitter | Google+ | RSS Feed

No comments:

Post a Comment