Commit bff9edfc authored by NENAVATH SRIKANTH's avatar NENAVATH SRIKANTH
Browse files

Sum of number

parent 47b78eb7
Pipeline #14878 passed with stage
in 13 seconds
#Calculate the sum of first N positive integers.
#Read the input from the user
n = int(input("Enter a positive integer: "))
#Calculate the sum
total = n * (n+1) / 2
#Display the result
print("The sum of the first",n,"positive integers",total)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment