Advertisement
Ankit_132

C

Feb 28th, 2024
922
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.21 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5.     int t;
  6.     cin>>t;
  7.    
  8.     while(t--){
  9.         int n;
  10.         cin>>n;
  11.        
  12.         long long int x = (n*1ll*(n+1))/2;
  13.        
  14.         cout<<x-1+n<<"\n";
  15.     }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement