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
84bd14f2
Commit
84bd14f2
authored
Jan 07, 2019
by
Jamjars
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Final Tweaks
parent
36e972be
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
AssessmentPartOne.java
src/AssessmentPartOne.java
+4
-4
No files found.
src/AssessmentPartOne.java
View file @
84bd14f2
...
...
@@ -42,15 +42,15 @@ public class AssessmentPartOne {
// You should comment your code explaining what each part does
int
sum
OfSquares
=
0
;
int
sum
=
0
;
//int for storing the total
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
sum
OfSquares
+=
(
start
+
i
);
//adds value to the running total
for
(
int
i
=
1
;
i
<
end
-
start
;
i
++)
{
//iterates through numbers between
start and end
sum
+=
(
start
+
i
);
//adds value to the running total
}
return
sum
OfSquares
;
return
sum
;
//returns the final total
}
...
...
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