1

I have to multiply two big numbers - saved as string - any hint how to do that?

Martin Ch
  • 1,337
  • 4
  • 21
  • 42

2 Answers2

5

Think back to grade school, and how you would solve the problem long-hand.

Mark Ransom
  • 299,747
  • 42
  • 398
  • 622
1

Depends on the language and how large the numbers are. For example in C, you can convert string to int with atoi and then multiply if the product will fit in 32bit int. If number is too large for 32bit you'll probably have to use third-party BigInt library. Some languages (python, haskell) have built-in support for bigint, so you can multiply numbers of any size.

kefeizhou
  • 6,234
  • 10
  • 42
  • 55