You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Online Programming/Sum of N/README.md
+8-8Lines changed: 8 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -1,18 +1,18 @@
1
-
#ARRAY SUM OF SIZE N
1
+
#ARRAY SUM OF SIZE N
2
2
3
-
##This is a solution to HackerEarth problem. Following steps are followed:
3
+
##This is a solution to HackerEarth problem. Following steps are followed:
4
4
5
-
1. First, we take the size of the array as input (N).
5
+
- First, we take the size of the array as input (N).
6
6
7
-
2. Then, the array is declared to be of integer type.
7
+
- Then, the array is declared to be of integer type.
8
8
9
-
3. The space separated array elements are taken as input from user.
9
+
- The space separated array elements are taken as input from user.
10
10
11
-
4. An integer type variable called *sum* is declared and initialised with value 0 as no array element is added yet.
11
+
- An integer type variable called *sum* is declared and initialised with value 0 as no array element is added yet.
12
12
13
-
5. 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.
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
14
15
-
6. Lastly, the variable sum which contains the final answer is printed as the output.
15
+
- Lastly, the variable sum which contains the final answer is printed as the output.
16
16
17
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/
0 commit comments