Coders Packet

Multiplication of Large numbers using Strings in C++

By Podila Rithwik Teja

Sometimes multiplication of two numbers cannot be stored due to the size limit. We solve this problem by using Strings in C++.

Many times when we work with large numbers like population, product numbers we might have experienced some error in the result for multiplication(which is due to we cannot store such large numbers in data structures like int or float). In such cases, we use strings and use an array to store the result. we solve by using basic mathematics technique and store digit by digit in the array. We traverse all digit's first and second numbers in a loop and add the result at the appropriate position.

Download Complete Code


No comments yet