上传文件至「0228」
100以内的质数
This commit is contained in:
23
0228/242.cpp
Normal file
23
0228/242.cpp
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
#include<iostream>
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
int main(){
|
||||||
|
|
||||||
|
|
||||||
|
for(int a=2;a<=100;a++){
|
||||||
|
|
||||||
|
bool x=true;
|
||||||
|
|
||||||
|
for(int i=2;i*i<=a;i++)
|
||||||
|
if(a%i==0){
|
||||||
|
|
||||||
|
x=false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(x){
|
||||||
|
cout<<a<<" ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cout<<endl;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user