aboutsummaryrefslogtreecommitdiff
path: root/challenge-150/robert-dicicco/ruby/ch-1.rb
diff options
context:
space:
mode:
authorMohammad S Anwar <mohammad.anwar@yahoo.com>2022-02-02 17:16:00 +0000
committerMohammad S Anwar <mohammad.anwar@yahoo.com>2022-02-02 17:16:00 +0000
commitea530bc5cf89e42ab0175eec72b2ebccfa3fdad4 (patch)
treeb0c67aab5f3f0b89abe7ec3eb107a7648a2f32e4 /challenge-150/robert-dicicco/ruby/ch-1.rb
parent05594b511709e75cc13c72043d2cec77bfeb5d3a (diff)
downloadperlweeklychallenge-club-ea530bc5cf89e42ab0175eec72b2ebccfa3fdad4.tar.gz
perlweeklychallenge-club-ea530bc5cf89e42ab0175eec72b2ebccfa3fdad4.tar.bz2
perlweeklychallenge-club-ea530bc5cf89e42ab0175eec72b2ebccfa3fdad4.zip
- Added solutions by Robert DiCicco.
Diffstat (limited to 'challenge-150/robert-dicicco/ruby/ch-1.rb')
-rw-r--r--challenge-150/robert-dicicco/ruby/ch-1.rb32
1 files changed, 32 insertions, 0 deletions
diff --git a/challenge-150/robert-dicicco/ruby/ch-1.rb b/challenge-150/robert-dicicco/ruby/ch-1.rb
new file mode 100644
index 0000000000..57459d2a14
--- /dev/null
+++ b/challenge-150/robert-dicicco/ruby/ch-1.rb
@@ -0,0 +1,32 @@
+#!ruby.exe
+
+# Author: Robert DiCicco
+# Date: 31-JAN-2022
+# Challenge 150 Fibonacci Words (Ruby)
+
+a = '1234'
+b = '5678'
+
+# recursive routine to create fibonacci series, but using strings
+
+def Fib ( first, second)
+ val = first + second
+ puts val
+
+ # if new string length is less than 51, go another round using new combined string
+ if val.length < 51 then
+ Fib( second, val)
+ else
+ # return the string if length 51 or greater
+ return val
+ end
+
+end
+
+puts 'Fibonacci Words'
+puts a
+puts b
+
+# get the 51st character
+char = Fib(a,b)[50].chr
+puts "51st digit is " + char