编程计算1~n之间所有素数的和,其中n的值从键盘输入,且n>50,要求编写两个函数,一个函数判断某个数是否为素数,另一个

学习 时间:2026-10-24 13:30:59 阅读:177
编程计算1~n之间所有素数的和,其中n的值从键盘输入,且n>50,要求编写两个函数,一个函数判断某个数是否为素数,另一个函数实现累加求和,在主函数中输入n,并输出计算结果.自己编的感觉太乱,

最佳回答

无聊的冥王星

包容的小蝴蝶

2026-10-24 13:30:59

#include
#include
using namespace std;
bool prime(int n){
\x09for(int i=2;in;
\x09cout

最新回答共有2条回答

  • 无辜的香烟
    回复
    2026-10-24 13:30:59

    #include #include using namespace std;bool prime(int n){\x09for(int i=2;in;\x09cout

上一篇 many students got a least a con the tests and there were man

下一篇 铝合金地垫怎么选