I found it difficult to multiply all my elements of an array. I am writing two arrays of elements, and after that I am merging those two arrays to one array of negative numbers. Later, I want to multiply all elements of that merged array. This is my try:
int mul = 0;
for (i = 0; i < negativecount; ++i)
{
mul = mul * merge[i];
}
cout << mul << endl;
}
And I am getting random numbers as the answer. How do I fix this problem?
The initial value of mul
must be 1.