fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5.  
  6. long long x;
  7. cin>>x;
  8. long long sum = x * (x + 1) / 2;
  9. cout << sum;
  10. }
  11.  
Success #stdin #stdout 0.01s 5320KB
stdin
3
stdout
6