-
[C/C++] 백준 8393번 1부터 n까지의 총합Logic/백준 2019. 1. 5. 19:42
#include <iostream>
using namespace std; int main() { int n; int sum = 0; cin >> n; for (int i = 0; i <= n; i++) { sum += i; } cout << sum; return 0; } Comment
#include <iostream>
using namespace std;
int main() {
int n;
int sum = 0;
cin >> n;
for (int i = 0; i <= n; i++)
{
sum += i;
}
cout << sum;
return 0;
}
Comment