2024-3-4
This commit is contained in:
20
Chapter1/b/b.cpp
Normal file
20
Chapter1/b/b.cpp
Normal file
@@ -0,0 +1,20 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
|
||||
void main()
|
||||
{
|
||||
int i = 0, j = 0, count = 0;
|
||||
for (i = 2; i <= 1000; i++)
|
||||
{
|
||||
for (j = 2; j <= i - 1; j++)
|
||||
if (i % j == 0)
|
||||
break;
|
||||
if (j > i - 1)
|
||||
{
|
||||
cout << j << '\t';
|
||||
count++;
|
||||
if (count % 5 == 0) cout << endl;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
Reference in New Issue
Block a user