1.

The following code has error(s). Rewrite the correct code underlining all the corrections made :int j ;int i = 15;int flag = 1;       while (j = 2; j < i; j ++)          {                   if(i % j = 0)                        {                                   flag = = 0;                                    break;                          }               }

Answer»

Correct Code :

int j ;

int i = 15;

int flag = 1;

while(j =2;j<1;j++)

{

      if(i%j==0)

      {

      flag =0;

      break;

      }

}



Discussion

No Comment Found

Related InterviewSolutions