Asked by sardar
int carry=0;
int prod,i,j,rem;
int base=10;
else if ( op == '*' ) //checks for operator, performs array multiplication
{
for(i=size-1; i>-1;i--)
{
for(int j=size-1; j>-1;j--)
{
prod =firNum[i]*secNum[j];
prod += carry;
if(prod>=base)
{
carry = (prod/base);
prod -= (carry*base);
}
else
{
carry = 0;
final[i+j] += prod;
if(final[i+j] >= base)
{
rem = (final[i+j]/base);
final[i+j] -= rem*base;
carry += rem;
}
if(final[i+j] >= base)
{
final[i+j-1] += (final[i+j]/base);
final[i+j] = final[i+j] % base;
}
}
}
}
int prod,i,j,rem;
int base=10;
else if ( op == '*' ) //checks for operator, performs array multiplication
{
for(i=size-1; i>-1;i--)
{
for(int j=size-1; j>-1;j--)
{
prod =firNum[i]*secNum[j];
prod += carry;
if(prod>=base)
{
carry = (prod/base);
prod -= (carry*base);
}
else
{
carry = 0;
final[i+j] += prod;
if(final[i+j] >= base)
{
rem = (final[i+j]/base);
final[i+j] -= rem*base;
carry += rem;
}
if(final[i+j] >= base)
{
final[i+j-1] += (final[i+j]/base);
final[i+j] = final[i+j] % base;
}
}
}
}
Answers
Answered by
Writeacher
If you really want an expert to help you, be sure to follow directions and type your <u>subject</u> in the <b>School Subject</b> box. Any other words, <u>including obscure abbreviations</u>, are likely to delay responses from a teacher who knows that subject well.
Answered by
MathMate
The program will not compile, because many variables are undefined (for C/C++/C# or Java).
You will need to define a variable before first use.
Also, an if statement cannot start with "else if".
Perhaps you have missed out a part of the code.
You will need to define a variable before first use.
Also, an if statement cannot start with "else if".
Perhaps you have missed out a part of the code.
There are no AI answers yet. The ability to request AI answers is coming soon!
Submit Your Answer
We prioritize human answers over AI answers.
If you are human, and you can answer this question, please submit your answer.