search for the sum of numbers from 1 to n where n is any positive integer

Closed due to the fact that off-topic participants Enikeyschik , andreymal , Sergey Gornostaev , 0xdb , aleksandr barakin 10 March at 7:32 .

It seems that this question does not correspond to the subject of the site. Those who voted to close it indicated the following reason:

  • " Learning tasks are allowed as questions only on condition that you tried to solve them yourself before asking a question . Please edit the question and indicate what caused you difficulties in solving the problem. For example, give the code you wrote, trying to solve the problem "- Enikeyschik, andreymal, Sergey Gornostaev, 0xdb, aleksandr barakin
If the question can be reformulated according to the rules set out in the certificate , edit it .

  • one
    What is the actual problem? - andreymal
  • Study assignments are allowed as questions only under the condition that you tried to solve them yourself before asking a question. Please edit the question and indicate what caused you difficulties in solving the problem. For example, give the code you wrote trying to solve the problem - 0-Level UNIX Monk

1 answer 1

n = int(raw_input()) ans = (n+1)*n/2 print ans 

if python 2.7, and if 3.7, then

 n = int(input()) ans = (n+1)*n/2 print(ans) 

PS Use this site when you have a mistake that you cannot solve, and not when you do not know what to do!

  • PS good, only you should delete your answer, and then you will get even more minuses. - 0-Level UNIX Monk