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

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

最佳回答

眼睛大的白羊

自然的牛排

2026-06-05 00:14:39

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

最新回答共有2条回答

  • 慈祥的蓝天
    回复
    2026-06-05 00:14:39

    #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

下一篇 铝合金地垫怎么选