摘要: 算法: 1 #include<iostream> 2 using namespace std; 3 int main() 4 { 5 float ave,score,max,min,sum=0; 6 int n=0; cin>>score; 7 max=min=score; 8 while(score>=0) 9 {10 sum=sum+score;11 n++;12 cin>>score;13 ave=sum/n;14 if(score<0) break;15 ... 阅读全文
posted @ 2012-04-13 11:44 iamvirus 阅读(13426) 评论(0) 推荐(0) 编辑
摘要: 算法: 1 #include<iostream> 2 #include<cmath> 3 using namespace std; 4 int main() 5 { 6 int i,k,n; 7 for(n=3;n<=100;n++) 8 { 9 k=sqrt(n);10 for(i=2;i<=k;i++)11 if(n%i==0) break;12 if(i>=k+1)13 cout<<n<<"是素数"<<endl;14 }15 ... 阅读全文
posted @ 2012-04-13 10:59 iamvirus 阅读(451) 评论(1) 推荐(0) 编辑