Commit e5cb43a0 authored by sebastiao.henrique's avatar sebastiao.henrique

ktjyhgtf

parent 7805f22d
Pipeline #375 canceled with stages
...@@ -7,30 +7,33 @@ public class AssessmentPartOne { ...@@ -7,30 +7,33 @@ 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) //I changed the < the other way around
{ {
if (num3>num1) if (num3 > num1)
{ {
return num3; return num3;
}
else } else
{ {
return num1; return num1;
} }
}
else }else
{ {
if (num3>num2) if (num3 > num2)
{ {
return num3; return num3; //A ; was added to remove errors
}
else
} else
{ {
return num2 return num2;
} }
} }
} }
public int sumNumbersBetween(int start, int end) public int sumNumbersBetween(int start, int end)
{ {
// 02 - Adding Across A Range // 02 - Adding Across A Range
...@@ -45,6 +48,27 @@ public class AssessmentPartOne { ...@@ -45,6 +48,27 @@ public class AssessmentPartOne {
int sumOfSquares = 0; int sumOfSquares = 0;
if (start <= -1)
{
return -1;
}
if (end<= -1)
{
return -1;
}
if (end -1 <= start +1)
{
return -1;
}
for (int i = start + 1; i <= end - 1; i++)
{
sumOfSquares = sumOfSquares + i;
}
return sumOfSquares; 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