Posted by Bo0mer Sat 20th Jan 2007 10:06 - Syntax is C++ - 22 views
Download | New Post | Modify | Hide line numbers
Download | New Post | Modify | Hide line numbers
-
#include
-
#include
-
#include
-
using namespace std;
-
int main()
-
{ ofstream outfile("test.txt");
-
int n;
-
int i;
-
int j;
-
int f;
-
cout << "n= ";
-
cin >> n;
-
for (int i = 3; ; i += 2)
-
{
-
f = 0;
-
for (int j = 3; j <= (int)(i / 3); j += 2)
-
{
-
if (i % j == 0)
-
{
-
f = 1;
-
break;
-
}
-
}
-
if (f == 0)
-
{
-
outfile << i << " ";
-
n = n - 1;
-
if (n == 0)
-
break;
-
}
-
}
-
outfile.close();
-
return 0;
-
}
PermaLink to this entry https://pastebin.co.uk/9360
Posted by Bo0mer Sat 20th Jan 2007 10:06 - Syntax is C++ - 22 views
Download | New Post | Modify | Hide line numbers
Download | New Post | Modify | Hide line numbers