五彩缤纷(c++)
查看原帖
五彩缤纷(c++)
1120247
__asdfASDF12345楼主2023/11/5 10:06
#include<iostream>
using namespace std;
int main()
{
    int l,x=0,s=0;
    bool flag=false;
    cin>>l;
    for(int i=2;i<l;i++)
    {
        for(int j=2;j<i;j++)
        {
            if(i%j==0)flag=true;
        }
        if(flag==false)
        {
            cout<<i<<endl;
            x++;
            s+=i;
        }
    }
    cout<<x<<endl;
    system("pause");
    return 0;
}

五彩缤纷

2023/11/5 10:06
加载中...