Skip to content

Commit 80d7a6f

Browse files
authored
Merge pull request Kvaibhav01#6 from Yashika25/master
ADD ARRAY ELEMENTS
2 parents 4574639 + 9f99bee commit 80d7a6f

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

Online Programming/Sum of N/README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# ARRAY SUM OF SIZE N
2+
3+
## This is a solution to HackerEarth problem. Following steps are followed:
4+
5+
- First, we take the size of the array as input (N).
6+
7+
- Then, the array is declared to be of integer type.
8+
9+
- The space separated array elements are taken as input from user.
10+
11+
- An integer type variable called *sum* is declared and initialised with value 0 as no array element is added yet.
12+
13+
- 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.
14+
15+
- Lastly, the variable sum which contains the final answer is printed as the output.
16+
17+
### 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/
18+
19+
## #HAPPYCODING ;)
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# SUM OF SQUARES OF ARRAY OF SIZE N
2+
3+
## Following steps are followed:
4+
5+
- First, we take the size of the array as input (N).
6+
7+
- Then, the array is declared to be of integer type.
8+
9+
- The space separated array elements are taken as input from user.
10+
11+
- An integer type variable called *sum* is declared and initialised with value 0 as no array element is added yet.
12+
13+
- 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.
14+
15+
- Lastly, the variable sum which contains the final answer is printed as the output.
16+
17+
## #HAPPYCODING ;)

0 commit comments

Comments
 (0)