Ethiopian multiplication: Difference between revisions
Content added Content deleted
Line 623: | Line 623: | ||
=={{header|D}}== |
=={{header|D}}== |
||
<lang d>int ethiopian(int n1, int n2) { |
<lang d>int ethiopian(int n1, int n2) { |
||
if (n1 < 0) { |
|||
throw new Exception("muliplier cannot be negative"); |
|||
} |
|||
static int doubleNum(int n) { return n * 2; } |
static int doubleNum(int n) { return n * 2; } |
||
static int halveNum(int n) { return n / 2; } |
static int halveNum(int n) { return n / 2; } |