MCPcopy Create free account
hub / github.com/Compaile/ctrack / sum_of_squares

Function sum_of_squares

examples/basic_singlethreaded.cpp:6–13  ·  view source on GitHub ↗

Function to calculate the sum of squares from 1 to n

Source from the content-addressed store, hash-verified

4
5// Function to calculate the sum of squares from 1 to n
6double 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
16unsigned long long factorial(int n) {

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected