the question is:

there is no zero in the number system.there are separete characters denoting ones,tens,hundreds, thousands, ten thousands.....etc...
I for one(its a vertical line and not 1)
n for ten
9 for hundred
8 for thousand
r for ten thousand
(the actual egyptian hieroglyphys were more picturesque but followed the general shape of these moder symbols. for this problem we will not consider numbers greater than 99,999.)

numbers were written as a group of ones preceded in turn by group of tens, hundreds, thousands and ten thousands. thus our number 4,023 would br rendered: III nn 8888.
notice that a zero digit is indicated by a group consisting of none of the corresponding symbol. the number 40,230 wuld thus be rendered nnn 99 rrrr.

to multiply two numbers a and b the egyptians would work with two columns of numbers. they would begin by writing the number I in the left column beside the number a in the right column. they would proceed to form a new rows by doubling the numbers in both columns. notice that doubling can be effected by copying symbols and normalizing by carrying proccess if any group of symbols is larger than 9 in size. doubling would continue as long as the number in the left column does not exceed the other multiplicand b. the numbers in the first column that summed to the multiplicand b were marked with asterisk. the numbers in the right column alongside the asterisks were then added to produce the result. below, we show the steps corresponding to the multiplication of 483 by 27:
I* III nnnnnnnn 9999
II* IIIIII nnnnnn 999999999
IIII II nnn 999999999 8
IIIIIIII* IIII nnnnnn 99999999 888
IIIIII n* IIIIIIII nn 9999999 8888888

the solution is: I nnnn 888 r
(the solution came from adding together : III nnnnnnnn 9999, IIIIII nnnnnn 999999999, IIII nnnnnn 99999999 888, IIIIIIII nn 9999999 8888888.)
you are to write a program to perform this egyptian multiplication.

sample Input & output:-

enter 1st number: IIIIIII nn
enter 2nd number III nnnnnnnn 9999

result: I nnnn 888 r

This article has been dead for over six months. Start a new discussion instead.