Sum of the Series

Description:

Write a program to find sum of series Hint:1+2+3+4+n Test Case 1 Input (stdin) 18 Expected Output 171 Test Case 2 Input (stdin) 100 Expected Output 5050

Program :

num = int(input())

hold = num

sum = 0

if num <= 0:

    print("Enter a whole positive number!")

else:

    while num > 0:

        sum = sum + num

        num = num - 1;

   

    print(sum)