How to design any base multiplication? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to design any base multiplication?

To design a base multiplication That's Sample input Base is 5 Digit 1 :-1220 Digit 2 :- 31 Output 43320

20th Mar 2022, 1:58 PM
HARSH GARG
HARSH GARG - avatar
2 Answers
+ 1
It depends on what you're allowed to do. As sugested by Ipang you could convert numbers from a base to decimal numbers, calculate product of them and convert the result back into the base. Here an example with base 2: https://code.sololearn.com/cbq12cROX96D/?ref=app
20th Mar 2022, 3:38 PM
JaScript
JaScript - avatar
0
1220 in base 5 is 185 in decimal 31 in base 5 is 16 in decimal How come result was 43.320? Did I calculate it wrong or misunderstood?
20th Mar 2022, 2:54 PM
Ipang