Please enter your email address or userHandle.
Write a program to find the sum of the given series 1+2+3+ . . . . . .(N terms)
N = 1
Explanation: For n = 1, sum will be 1.
N = 5
Explanation: For n = 5, sum will be 1
+ 2 + 3 + 4 + 5 = 15.
Complete the function seriesSum() which takes single integer n, as input parameters and returns an integer denoting the answer. You don't to print answer or take inputs.
Expected Time Complexity: O(1)
Expected Auxiliary Space: O(1)
1 <= N <= 105
We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?
Login to access your submissions.
Please choose 'ReadOnlyMode' if you needn't to 'Edit' the problem e.g. viewing OJ's solution, TestCase Files (TCFs), TimeLimit etc.