Skip to content

Instantly share code, notes, and snippets.

@Baekjoon
Created May 17, 2015 12:59
Show Gist options
  • Save Baekjoon/1c36f9f8e4f45c406889 to your computer and use it in GitHub Desktop.
Save Baekjoon/1c36f9f8e4f45c406889 to your computer and use it in GitHub Desktop.
sum
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
int sum = 0;
for (int i = 1; i <= n; ++i) {
sum += i;
}
cout << sum << endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment