Q)The sum of the squares of the first ten natural numbers is,
#include #define N 100 using namespace std; long raiseTo ( const long num, const long n ) { int ans = num; for ( int i = 1; i < n; i++ ) { ans *= num; } return ans; } int main ( int argc, char * argv[] ) { long result = ( ( raiseTo ( N, 4 ) / 4 ) + ( raiseTo ( N, 3 ) / 6 ) - ( raiseTo ( N, 2 ) / 4 ) - ( N / 6 ) ); cout << result << endl; } // 25164150