20分求助
查看原帖
20分求助
954175
_Daniel_楼主2023/5/7 17:33
#include<iostream>
using namespace std;
int main()
{
    long long a,b,c;
    bool d;
    d=true;
    cin>>a;
    c = a;
    for (int i=2;i<=a;i++)
    {
        for (int j=2;j<a;j++)
        {
            if(i%j!=0)
                d=false;
            
        }
        if(d)
        {
            b++;
        }
        d=true;
    }
    cout<<b;
    return 0;
}
2023/5/7 17:33
加载中...