Documentation
Input
Enter first large number: 123456789123456
Enter second large number: 987654321987654
Output
Product: 121932631356500531347203169024
Logic Used
-
Read numbers as strings
-
Perform multiplication digit by digit (like manual multiplication)
-
Store intermediate results in an array
-
Convert the result back to a string
-
Large numbers are stored as strings
-
No use of
long longor external libraries -
Time Complexity: O(n × m)
-
Works for any number of digits