forked from appdev-projects/ruby-sandbox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathraindrops.rb
35 lines (31 loc) · 826 Bytes
/
raindrops.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
integers = [1, 21, 35, 105]
integer = integers.sample
# write your program below
# integer = 21
raindrops = ""
if integer % 3 == 0 && integer % 5 == 0 && integer % 7 == 0
raindrops += "Pling"
raindrops += "Plang"
raindrops += "Plong"
pp raindrops
elsif integer % 3 == 0 && integer % 5 == 0
raindrops += "Pling"
raindrops += "Plang"
pp raindrops
elsif integer % 3 == 0 && integer % 7 == 0
raindrops += "Pling"
raindrops += "Plong"
pp raindrops
elsif integer % 5 == 0 && integer % 7 == 0
raindrops += "Plang"
raindrops += "Plong"
pp raindrops
elsif integer % 5 == 0
raindrops += "Plang"
pp raindrops
elsif integer % 7 == 0
raindrops += "Plong"
pp raindrops
else
pp integer
end