Home > Back-end >  Pray god to help
Pray god to help

Time:10-15

Of prime Numbers between 1-100, with the do while loop, will give miss 2, how to modify the



#include
#include
using namespace std;
Int main ()
{
Int flag, I, k, j;


I=2;

Do
{
flag=1;
J=2;
K=SQRT (int) (I);
Do
{
If (I % j==0)
{
flag=0;
break;
}
j++;
} while (j<=k);
If (flag)
Couti++;
} while (i<=100);
return 0;
}

CodePudding user response:

2 either at the beginning, and then I started from 3; Either the if (I % j==0) to if (I % j==0 & amp; & j
  • Related