主题:求素数的!!求改进!!新手!!
#include<iostream>
using namespace std;
int main()
{ int a[105];
int i,j;
for(i=0;i<=100;i++){
a[i]=i;
if(a[i]<=2)
cout<<a[i]<<endl;
for(j=2;j<=i-1;j++){
if(a[i]>2){
if(a[i]%j==0)
break;
if(j==i-1)
cout<<a[i]<<endl;
}
}
}
return 0;
}
using namespace std;
int main()
{ int a[105];
int i,j;
for(i=0;i<=100;i++){
a[i]=i;
if(a[i]<=2)
cout<<a[i]<<endl;
for(j=2;j<=i-1;j++){
if(a[i]>2){
if(a[i]%j==0)
break;
if(j==i-1)
cout<<a[i]<<endl;
}
}
}
return 0;
}