I'm working on a program that takes two large numbers, stored in arrays of integers (one digit of the number per location) and performs multiplication to get their product in another array. My code gives an answer and some of the answers seem right and some don't. I wanted to post on here hoping that someone might can see why some of my answers are incorrect.
Here is the function that multiplies the arrays together:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
void getProduct (int top[], int bottom[], int product[])
{
for (int k = (MAX - 1); k > 0; k--)
{
for (int i = (MAX - 1); i > 0; i--)
{
product[i] = bottom[k] * top[i] + product[i];
if (product[i] > 9)
{
product[i - 1] = product[i] / 10;
product[i] = product[i] % 10;
}
}
}
}
And here is the output that I am getting. This output has been formatted.