0

# Find the product/addition of the biggest digit of length 50

27th Mar 2017, 10:45 AM
+ 6
For Java, you may use BigInteger
27th Mar 2017, 11:41 AM
Heng Jun Xi
+ 3
I don't understand the question. For example, the number 100 has 3 digits - a digit by definition can only be of length 1! Do you mean a number with 50 digits length? Anyway, your question is too vague; the way your question is structured it can be your number itself. Let's say your 50 digit number is X. The biggest operant in a product is X since X*1=X. And the biggest operant in a sum is still X since X+0=X.
27th Mar 2017, 1:08 PM
Ettienne Gilbert
+ 3
Hi @Siddharth, ok - understood. For numbers that large I would also recommend you use a BigIntereger library (often called an "extended precision" library). In C++, unlike Java, there is no BigIntereger in the C++ std lib, so you need to use a 3rd party lib. You can look here for recommendations of some libraries: http://stackoverflow.com/questions/4997363/stl-big-int-class-implementation Note that some of these libraries are in fact written in C (which is true for a lot of nemerical processing code), but that is no obstacle to their usage in C++ code.
28th Mar 2017, 2:51 PM
Ettienne Gilbert
0
I means to say 122223222222222122223344456666677777777788888888887542234555677778889999952222456787888899642256788989897422456778899 addition/product of this type of number
27th Mar 2017, 6:43 PM