Created
August 3, 2019 18:28
-
-
Save thecoducer/47e6cc2220f5a8dd49e7c639c7505e1a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<bits/stdc++.h> | |
using namespace std; | |
int main(void) | |
{ | |
int t; | |
long n, sum = 0; | |
cin >> t; | |
while(t--){ | |
cin >> n; | |
sum = ((n * (n + 1)) * ((2 * n) + 4)) / 12; | |
cout << sum << endl; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment