Skip to content

Commit

Permalink
Merge pull request Kvaibhav01#6 from Yashika25/master
Browse files Browse the repository at this point in the history
ADD ARRAY ELEMENTS
  • Loading branch information
Kvaibhav01 authored Oct 4, 2018
2 parents 4574639 + 9f99bee commit 80d7a6f
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
19 changes: 19 additions & 0 deletions Online Programming/Sum of N/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# ARRAY SUM OF SIZE N

## This is a solution to HackerEarth problem. Following steps are followed:

- First, we take the size of the array as input (N).

- Then, the array is declared to be of integer type.

- The space separated array elements are taken as input from user.

- An integer type variable called *sum* is declared and initialised with value 0 as no array element is added yet.

- Now, a for loop is used to read each element starting from index 0 to N-1 and are simultaneously added to previous value of sum and array element present at that particular loop index.

- Lastly, the variable sum which contains the final answer is printed as the output.

### Find the link to the problem statement here: https://www.hackerearth.com/practice/basic-programming/implementation/basics-of-implementation/practice-problems/algorithm/array-sum-2-725368ac/

## #HAPPYCODING ;)
17 changes: 17 additions & 0 deletions Online Programming/Sum of squares/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# SUM OF SQUARES OF ARRAY OF SIZE N

## Following steps are followed:

- First, we take the size of the array as input (N).

- Then, the array is declared to be of integer type.

- The space separated array elements are taken as input from user.

- An integer type variable called *sum* is declared and initialised with value 0 as no array element is added yet.

- Now, a for loop is used to read each element starting from index 0 to N-1 and are simultaneously added to previous value of sum and array element present at that particular loop index is added two times.

- Lastly, the variable sum which contains the final answer is printed as the output.

## #HAPPYCODING ;)

0 comments on commit 80d7a6f

Please sign in to comment.