#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
int a[10005];
char b[10005];
int main()
{
int n;
while(cin>>n){
int flag=1;
for(int i=2;i<=n;i++){
flag=1;
for(int j=2;j<i;j++){
if(i%j==0) flag=0;
}
if(flag) cout<<i<<endl;
}
}
return 0;
}
Primes in practice by seeking the sieve # N # Bridge Cup Blue
Guess you like
Origin blog.csdn.net/weixin_43476037/article/details/104009595
Ranking