Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
Assessment 01
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ollie Rhodes
Assessment 01
Commits
cd8a8abe
Commit
cd8a8abe
authored
Nov 12, 2018
by
oliver.rhodes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Finished
parent
d80a8cd9
Pipeline
#273
canceled with stages
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
1 deletion
+9
-1
AssessmentPartOne.java
src/AssessmentPartOne.java
+9
-1
No files found.
src/AssessmentPartOne.java
View file @
cd8a8abe
...
...
@@ -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
;
}
return
sumOfSquares
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment