Anonymous user
Ethiopian multiplication: Difference between revisions
m
Formatting of header material
m (→{{header|Tcl}}: closer match with varnames from other examples) |
m (Formatting of header material) |
||
Line 3:
'''Method:'''<br>
'''For example:''' 17 x 34
17 34
Halving the first column:
17 34
8
Line 20 ⟶ 17:
2
1
Doubling the second column:
17 34
8 68
Line 28 ⟶ 23:
2 272
1 544
Strike-out rows whose first cell is even:
17 34
8 --
Line 36 ⟶ 29:
2 ---
1 544
Sum the remaining numbers in the right-hand column:
17 34
8 --
Line 46 ⟶ 37:
====
578
So 17 multiplied by 34, by the Ethiopian method is 578.
The task is to '''define three functions'''/methods/procedures/subroutines:
# one to '''halve an integer''',
# one to '''double an integer''', and
# one to '''state if an integer is even'''.
Use these functions to '''create a function that does Ethiopian multiplication'''.
'''References'''
=={{header|C}}==
|