programming-examples/python/_Basics/Sum of the first n positive integers.py

3 lines
85 B
Python
Raw Normal View History

2019-11-15 12:59:38 +01:00
n = int(input("Input a number: "))
sum_num = (n * (n + 1)) / 2
print(sum_num)