请编写一个函数int fun(int n),其中n为自然数。函数fun()的功能是求出自然数n(包括n)以内所有素数的和,并返回其值。 注意;部分源程序已存在文件PROC11.cpp中。 请勿修改主函数和其他函数中的任何内容,仅在函数fun()的花括号中填写若干语句。 文件PROC11.cpp的内容如下: //PROC11.cpp #include<iostream> using namespace std; int fun(int n); int main() int number; cout<<"Enter the number which you want to caculate: \n"; cin>>number; cout<<"The result is:"<<fun(number)<<end1; return 0; int fun(int n) //* * * * * * * * *
【参考答案】
函数fun()的定义如下: int fun(int n) { int i,j,sum=0......