Function to calculate the sum of squares from 1 to n
| 4 | |
| 5 | // Function to calculate the sum of squares from 1 to n |
| 6 | double sum_of_squares(int n) { |
| 7 | CTRACK; // Start tracking this function |
| 8 | double sum = 0; |
| 9 | for (int i = 1; i <= n; ++i) { |
| 10 | sum += i * i; |
| 11 | } |
| 12 | return sum; |
| 13 | } |
| 14 | |
| 15 | // Function to calculate the factorial of n |
| 16 | unsigned long long factorial(int n) { |