154k views
1 vote
I need it in code please (python)

I need it in code please (python)-example-1
User Rhapsodyn
by
5.2k points

2 Answers

6 votes
python coded) pythooonn
User Ryan Gadsdon
by
6.5k points
6 votes

Answer:

def main():

n = int(input("Enter a number to find its sum! "))

sum = int((n*(n+1)) / 2)

print(str(sum))

main()

Step-by-step explanation:

Here is some code I quickly came up with, you can rehash it for your liking.

I basically took this formula and translated it into python code on line 3. Make sure you use paratheses correctly when translating forumlas or any equation, Order of Operations is everything.

Lmk if this helped!

I need it in code please (python)-example-1
User Hugocarlmartin
by
5.3k points