Commit cd8a8abe authored by oliver.rhodes's avatar oliver.rhodes

Finished

parent d80a8cd9
Pipeline #273 canceled with stages
......@@ -44,8 +44,16 @@ public class AssessmentPartOne {
int sumOfSquares = 0;
if (start < 0 || end < 0 || end - start < 2) { //catches invalid inputs (negative start or end values and no values in between)
return -1;
} else {
for (int i = 1; i < end - start; i++) { //iterates through numbers between
sumOfSquares += (start + i); //adds value to the running total
}
return sumOfSquares;
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment