Created
November 30, 2017 03:51
-
-
Save dinhhuydh/230e1cd6859c4a71999d2339bdb73e05 to your computer and use it in GitHub Desktop.
Ruby loop exercises
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1. Returns the elements at even positions | |
# a = [5,6,7,3] | |
# => [5,7] (5 at index 0, 7 at index 2) | |
# 2. Calculate the fibonaci at n th (1,1,2,3) | |
# fibonaci(2) => 1 | |
# fibonaci(4) => 3 | |
# 3. Count how many number 4 in array | |
# [3,4,5] => 1 | |
# [2,6,7] => 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment