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

3 lines
85 B
Python
Raw Normal View History

2019-11-18 14:44:36 +01:00
n = int(input("Input a number: "))
sum_num = (n * (n + 1)) / 2
print(sum_num)