Advertisement
Josif_tepe

Untitled

Nov 15th, 2023
790
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.17 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main(){
  5.     int n;
  6.     cin >> n;
  7.    
  8.     int sum = n * (n + 1) / 2;
  9.    
  10.     cout << sum << endl;
  11.     return 0;
  12. }
  13.  
  14.  
  15.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement