You are on page 1of 1

A NEW NUMBER SYSTEM

February 5, 2013

In the traditional number system, 0 is represented as 0, 10 as 10, 11 as 11


and like that. But now we have a number system where we only have positive
integers. So we need to have a new representation for numbers whi h have 0 as
a digit.
Lets say 0 is represented as empty string, 10 as T, 20 as 1T, 30 as 2T, 40
as 3T and so on. Similarly 100 as 9T, 101 as T1 , 202 as 1T2 and like that. So
now numbers will represented as Strings of SML.
Now with this number system, we an also do the arithmeti operations like
addition, multipli ation, division and so on like we do on paper by taking 1 digit
at a time.
You need to implement the following operations on this representation of number system:

1.

Addition

2.

Subtra tion

3.

Multipli ation

4.

Division

5.

Modulus

As as simple example adding T1(101) and 9T(100), starting from the least
signi ant digit, we add 1 and T, we get 1 and 1 is sent to arry(just think T
as 10),then we add T and 9 with 1 as arry, we get 1T (add 9 and 1 we get T
and then T +T gives 1T). Hen e the ans is 1T1
Similar examples an be worked out for other operations.

You might also like