Skip to content

Instantly share code, notes, and snippets.

@karapetyan
Created October 11, 2015 10:06
Show Gist options
  • Save karapetyan/0284d4fe6d9616f52da2 to your computer and use it in GitHub Desktop.
Save karapetyan/0284d4fe6d9616f52da2 to your computer and use it in GitHub Desktop.
class Pentagon
def initialize(element)
penta = []
for i in 1..element
penta << (i * (3 * i - 1) / 2)
i += 1
end
puts penta
end
end
pe = Pentagon.new(10)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment