-
백준 8393번 합백준 algorithm 2020. 7. 8. 16:31반응형
https://www.acmicpc.net/problem/8393
8393번: 합
문제 n이 주어졌을 때, 1부터 n까지 합을 구하는 프로그램을 작성하시오. 입력 첫째 줄에 n (1 ≤ n ≤ 10,000)이 주어진다. 출력 1부터 n까지 합을 출력한다. 예제 입력 1 복사 3 예제 출력 1 복사 6...
www.acmicpc.net
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters#include <iostream> using namespace std; int main(void) { int n = 0; int sum = 0; cin >> n; for (int i = 1; i <= n; i++) { sum += i; } cout << sum; return 0; } 728x90'백준 algorithm' 카테고리의 다른 글
백준 2439번 별 찍기 -2 (0) 2020.07.08 백준 10871번 X보다 작은 수 (0) 2020.07.08 백준 2577번 숫자의 개수 (0) 2020.07.08 백준 10817번 세 수 (3) 2020.07.07 백준 2523번 별 찍기 -13 (5) 2020.07.07