Time:10-01
CodePudding user response:
the end result is what you want
#include using namespace std; Int jiecheng (int n); Double jiecheng1 (int n); Int main () {int n; Double m; Cout & lt; <"Please enter an integer:" & lt; cin> n; M=jiecheng1 (n); Cout & lt; <"The result is:" & lt; return 0; } Int jiecheng (int n) {Int I, sum=1; For (I=1; I<=n; I++) {The sum *=I; } return sum; } Double jiecheng1 (int n) {Int I, j, f=1; Double k=0; Double sum=0; For (I=1; I<=n; I++) {J=jiecheng (I); K=1/(double) j; If (I % 2==0) {K=k; } The sum +=k; } return sum; }
Page link:https//www.codepudding.com/Backend/45571.html