0

i want to ask how i am able to multiply large numbers in C#. If i had

string firstNumber = 135923852358239582395823952382395823951825873295723957623875623857263587236589273567283562835726385723656827356235235;

string secondNumber= 135923852358239582395823952382395823951825873295723957623875623857263587236589273567283562835726385723656827356235235;

i want to do this firstNumber * Second Number

  • 9
    You could parse them into [`BigInteger`](https://msdn.microsoft.com/en-us/library/system.numerics.biginteger(v=vs.110).aspx). `Console.WriteLine(BigInteger.Parse(firstNumber) * BigInteger.Parse(secondNumber));` – juharr Jun 02 '16 at 17:36
  • btw you missed double quotes for strings. – M.kazem Akhgary Jun 02 '16 at 17:38
  • 1
    Also: http://stackoverflow.com/q/279038/447156 – Soner Gönül Jun 02 '16 at 17:41
  • You don't. Those number are bigger then big integer. Why would you need to multiply number that big? – paparazzo Jun 02 '16 at 17:48
  • 1
    @Paparazzi No they're not. The answer (via parsing to BigInteger) is 18475293639904512084559159038493973411283439804954005546376625603615812799023790492467237643300612205082402966970756925004844150484699383955740178979751400427519750333764207395320715014879702523078179084504091642998778302232655505225 – juharr Jun 02 '16 at 17:52
  • @juharr Correct, I was looking at Uint64 – paparazzo Jun 02 '16 at 17:56

0 Answers0