Commit bd6475e2 authored by Romain's avatar Romain

Part One

parent 7b0cb082
Pipeline #249 canceled with stages
...@@ -7,7 +7,7 @@ public class AssessmentPartOne { ...@@ -7,7 +7,7 @@ public class AssessmentPartOne {
// Debug this method so it passes the unit test. // Debug this method so it passes the unit test.
// Add comments beside any changes you make // Add comments beside any changes you make
if (num1<num2)// if (num1>num2)// replace < by >
{ {
if (num3>num1) if (num3>num1)
{ {
...@@ -26,7 +26,7 @@ public class AssessmentPartOne { ...@@ -26,7 +26,7 @@ public class AssessmentPartOne {
} }
else else
{ {
return num2; return num2; // add ";" after num2
} }
} }
} }
...@@ -43,6 +43,16 @@ public class AssessmentPartOne { ...@@ -43,6 +43,16 @@ public class AssessmentPartOne {
// You should comment your code explaining what each part does // You should comment your code explaining what each part does
int sumOfSquares = 0; int sumOfSquares = 0;
if (start+1<end && start>=0)
{
for(int i=start+1;i<end;i++) // loop i=start+1 because start is not included and i<end because we add the last number before end
{
sumOfSquares=sumOfSquares+i;
}
}else
{
sumOfSquares=-1;
}
return sumOfSquares; return sumOfSquares;
......
...@@ -4,6 +4,7 @@ public class Hub { ...@@ -4,6 +4,7 @@ public class Hub {
public static void main(String[] args) { public static void main(String[] args) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
} }
} }
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