C++ Code:
VC++ 6.0 SP6+Windows XP
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#include "iostream.h"
#include "math.h"
int main(int argc, int* argv[])
{
bool isPrime=false; //判断条件
for(int i=1000;i<1100;i++)
{
for(int j=2;j<int(sqrt(i));j++)
{
if(i%j==0)
{
isPrime=false;
break;
}
isPrime=true;
}
if(isPrime)
{
cout<<i<<" ";
}
}
return 0;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
VB Code :
Visual Basic 6.0+Wndows XP
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
For n = 1000 To 1100
s = 0 '作为判断条件
For i = 2 To Int(Sqr(n))
If n Mod i = 0 Then
s = 1
Exit For
s = 0
End If
Next
If s = 0 Then
Print n
End If
Next
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////








