forked from newde/homework
镇乃天子
This commit is contained in:
20
260314/100以内的素数.cpp
Normal file
20
260314/100以内的素数.cpp
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
#include<iostream>
|
||||||
|
using namespace std;
|
||||||
|
int main(){
|
||||||
|
|
||||||
|
for(int i=2;i<100;i++){
|
||||||
|
bool n=true;
|
||||||
|
|
||||||
|
for(int j=2;j*j<=i;j++){
|
||||||
|
|
||||||
|
if(i%j==0){
|
||||||
|
n=false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(n)
|
||||||
|
cout<<i<<" ";
|
||||||
|
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user