programming-examples/python/_Basics/Sum of the first n positive integers.py
2019-11-15 12:59:38 +01:00

3 lines
85 B
Python

n = int(input("Input a number: "))
sum_num = (n * (n + 1)) / 2
print(sum_num)