-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkings.js
28 lines (25 loc) · 961 Bytes
/
kings.js
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
/*************************************************************************
* The Problem Solved Kings in JavaScript *
* ---------------------------------------------------------------------- *
* *
* POC: $ node kings *
* *
* Autor: Elton Fonseca *
* http://www.fb.com/elton.junior6 *
**************************************************************************/
function kings(rows, columns)
{
var i = 1, king = 0, j = 1;
while(i <= rows)
{
j = 1;
while(j <= columns)
{
king++;
j += 2;
}
i += 2;
}
console.log(king);
}
kings(10, 10);