-
Notifications
You must be signed in to change notification settings - Fork 0
/
kings.rb
25 lines (23 loc) · 931 Bytes
/
kings.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
#/*************************************************************************
#* The Problem Solved Kings in Ruby *
#* ---------------------------------------------------------------------- *
#* *
#* POC: $ ruby kings.rb *
#* *
#* Autor: Elton Fonseca *
#* http://www.fb.com/elton.junior6 *
#**************************************************************************/
def kings(rows, columns)
king = 0
i = 1
while i <= rows
j = 1
while j <= columns
king += 1
j += 2
end
i += 2
end
puts king
end
kings(10, 10)