15,748,477 members
See more:
hiii,
how can i do my project?
C#
```string str1="4567995244...4457";
string str2="1458795568...85498";

str1-str2; // differance
str1*str2; // multiplication
str1/str2; // division```

note: we dont use biginteger class also
we dont use arithmetic operatiors
Posted
Updated 29-Dec-12 5:44am
v2
Sergey Alexandrovich Kryukov 29-Dec-12 21:53pm
What's wrong with BigInteger?
—SA

## Solution 2

If I understood your question correctly, you first have to change the data type to something you can use in calculation. For example:
C#
`int a = int.Parse("123") + int.Parse("456");`

Of course you would use variables inside `TryParse `instead of constant strings.

Sergey Alexandrovich Kryukov 29-Dec-12 21:50pm
Parse is better, because this API name correctly tell us what really happens, unlike "Convert". My 5.
—SA
Wendelius 4-Jan-13 15:07pm
That's true, thanks :)

## Solution 3

If BigInteger is not good enough, look around here: http://www.codeplex.com/Wikipage?ProjectName=sine[^]

Sergey Alexandrovich Kryukov 29-Dec-12 21:53pm
Interesting, my 5. However, OP's idea about not using BigInteger is not motivated; most likely, this is just a mistake. As a rule of thumb, OP's "I want" or "I don't want" cannot be taken seriously.
—SA
Zoltán Zörgő 30-Dec-12 2:55am
Probably. But most likely the OP was told to implement these basic operation as pure symbol/string manipulation.
Sergey Alexandrovich Kryukov 30-Dec-12 13:16pm
Agree...
—SA

## Solution 1

Hi,

Try this:
C#
```string str1="4567995244...4457";
string str2="1458795568...85498";

decimal d1 = Convert.ToDecimal(str1);
decimal d2 = Convert.ToDecimal(str2);

decimal difference = d1-d2; // difference
decimal multiplication = d1*d2; // multiplication
decimal division = d1/d2; // division```

[EDIT]

Orhss wrote:
note: we dont use biginteger class also

I think there's no other option then using a `BigInteger`. Add a reference to System.Numerics.dll, add
C#
`using System.Numerics;`
to the top of your code file, and then use this code:
C#
```BigInteger b1 = BigInteger.Parse(str1);
BigInteger b2 = BigInteger.Parse(str2);

BigInteger addition = b1 + b2;
BigInteger difference = b1 - b2;
BigInteger multiplication = b1 * b2;
BigInteger division = b1 / b2;```

Hope this helps.

v2
ridoy 29-Dec-12 12:20pm
+5
Thomas Daniels 29-Dec-12 12:21pm
Thank you!
Orhss 29-Dec-12 12:33pm
your solution is true but we should use very long string
ex:
12345678901234567891234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
like this...
thanks
Thomas Daniels 29-Dec-12 12:49pm