this article I will show you about using BigInteger Class of the
framework 4.0 that can perform arithmetic operations on integer values
that can exceed the size of default numeric types. For example even
largest one Int64.MaxValue.Numeric values in .net framework have some
max and min values according to their memory allocation. BigInteger can
deal with bigger integers such like 91389681247993671255432112000000
that is not performable by default data types.
we want to do sum of 2 huge numbers that are bigger then Int64. We can
perform the operation by BigInteger class.
of all you need to import name space...
Here I am showing
screen shot of application.
private void button1_Click(object sender, EventArgs e)
BigInteger b1 = BigInteger.Parse(textBox1.Text);
BigInteger b2 = BigInteger.Parse(textBox2.Text);
BigInteger total = BigInteger.Add(b1, b2);
textBox3.Text = total.ToString();
You can perform basic operation like below code...
BigInteger bigInt1 = new
BigInteger bigInt2 = new BigInteger(123456789632312211212);
BigInteger Total =
Show the Result
I am listing some methods of BigInteger class that can be useful
for computing ..
more methods are available that are useful for arithmetic operations.
have just seen in this article how to deal with BigInteger Class of
.net framework 4.0 to perform arithmetic operations on values that are
bigger than default data types provided by .net framework.