Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Must be 6 bugs in the program below(Told by the Instructor).Could someone make a

ID: 3872950 • Letter: M

Question

 Must be 6 bugs in the program below(Told by the Instructor).Could someone make a list and do the debugging?   NOTE:This is the 6th time I'm asking this question, and someone found 12 bugs. PLEASE DON'T ANSWER MY QUESTIONS IF YOU'RE NOT SURE ABOUT THE SOLUTION. THANK YOU  #include  using namespace std;  void display(long a[5],int times){          cout << times << "-th loop result : ";         for(int i=0;i<5;i++){        cout << "a[" << i <<"]= " <<  a[i] << " " ;     }         cout << endl;  }  int main(){      long  int product;     long  productArray[5];              for( int i=1; i<=5 ; i++){        product *=i;        productArray[i] = product;        display(productArray,i);     }          int i=0,j;     int index[5];      while(j<5){        int remainder = productArray[i]%4;        if(remainder=0){           index[j] = i;           j++;        }        i++;     }          cout << "values in productArray( mod 4 equal to 0)  = ";     while(j<5){           cout << "a[" << productArray[index[j]] << "] ";            j++;       }       cout << endl;          return 0; } 

Explanation / Answer

#include<iostream.h>

#include<conio.h>

void display(int productArray[],int times)

{

cout << times << "-th loop result : ";

for(int i=1;i<=5;i++){

cout << "a[" << i <<"]= " << productArray[i] << " " ;

}

cout << endl;

}

int main()

{

int product=1;

int productArray[6];

int index[5],j;

clrscr();

for( int i=1; i<=5 ; i++)

{

product = product*i;

productArray[i] = product;

display(productArray,i);

}

i=1;

cout << "values in productArray( mod 4 equal to 0) = ";

while(i<=5)

{

int remainder = productArray[i]%4;

if(remainder==0)

{

cout << " "<< productArray[i] ;

}

i++;

}

cout << endl;

return 0;

}

Output:

1-th loop result : a[1]= 1 a[2]= 866631197 a[3]= 11122 a[4]= 142 a[5]= 0

2-th loop result : a[1]= 1 a[2]= 2 a[3]= 11122 a[4]= 142 a[5]= 0

3-th loop result : a[1]= 1 a[2]= 2 a[3]= 6 a[4]= 142 a[5]= 0

4-th loop result : a[1]= 1 a[2]= 2 a[3]= 6 a[4]= 24 a[5]= 0

5-th loop result : a[1]= 1 a[2]= 2 a[3]= 6 a[4]= 24 a[5]= 120

values in productArray( mod 4 equal to 0) = 24 120

I hope this will surely help You