n=int(input())
sum=0
for i in range(1,n+1):
    sum+=i
print(sum)

 

 

 

 

문제 : https://www.acmicpc.net/problem/8393

 

8393번: 합

n이 주어졌을 때, 1부터 n까지 합을 구하는 프로그램을 작성하시오.

www.acmicpc.net

 

'Baekjoon > python' 카테고리의 다른 글

[백준 2741번] N 찍기  (0) 2022.04.21
[백준 15552번] 빠른 A+B  (0) 2022.04.20
[백준 10950번] A+B - 3  (0) 2022.04.20
[백준 2739번] 구구단  (0) 2022.04.19
[백준 2480번] 주사위 세 개  (0) 2022.04.16

+ Recent posts