回覆列表
  • 1 # 手機使用者86633185310

    #include <iostream>

    #include <math.h>

    using namespace std;

    void FindPrime(int start,int end)

    { int i,j,x,c=0,s=0;

    for(i=start;i<=end;i++)

    {

    x=sqrt(i);

    for(j=2;j<=x;j++)

    if(i%j==0)break;

    if(j>x){

    c++;

    s+=i;

    cout<<i<<" ";

    if(c%5==0)

    cout<<endl;

    }

    }

    cout<<"\nprime total number is "<<c<<",sum is "<<s<<endl;

    }

    void main()

    {

    FindPrime(50,100);

    }

  • 中秋節和大豐收的關聯?
  • 都成空是哪首歌的歌詞?