+ 1
suppose you have this array as consecutive numbers and you need to find it sum
array = (1,2,3,4)
using for loop(or any) traverse the array and add each digit to a variable to get the sum
or much better
n = 4
for i = 1, i <= n; i++
s += i
s is the sum
or using maths
n * (n + 1) / 2
0
n = 4
print(sum(i for i in range(1, n+1)))
0
Try to use this:
https://code.sololearn.com/cnzzsxROL0tc/?ref=app
0
https://www.sololearn.com/Discuss/2726770/?ref=app
https://www.sololearn.com/Discuss/2726783/?ref=app
https://www.sololearn.com/Discuss/2726795/?ref=app
- 1
N = int(input())
count = N
x = range(1, N +1)
for i in x:
N = i + N
print(N - count)



