Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
MIS21
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Owen Ilagan
MIS21
Commits
b6398460
Commit
b6398460
authored
Jun 14, 2016
by
Owen Ilagan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
arrgh...
parent
15b58637
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
0 deletions
+24
-0
ruby_demo.rb
ruby_demo.rb
+24
-0
No files found.
ruby_demo.rb
View file @
b6398460
numbers
=
[
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
]
def
get_average
(
array
)
count
=
array
.
size
sum
=
0
array
.
each
do
|
num
|
sum
=
sum
+
num
end
return
sum
/
count
end
def
get_reverse
(
array
)
result
=
[]
array
.
reverse
.
each
do
|
num
|
result
.
push
(
num
)
end
return
result
end
puts
'Numbers are: '
+
numbers
.
join
(
','
)
puts
'Average value is '
+
get_average
(
numbers
).
to_s
puts
'Reverse is '
+
get_reverse
(
numbers
).
join
(
','
)
\ No newline at end of file
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