Define the function Total (n), calculate 1 + 2 + 3 +... + N, the function return type is int In the main function input positive integer n, call the function Total (n) to calculate and output the value of the following formula S=1+1/(1+2)+1/(1+2+3)+...+1/(1+2+3+...+n) My answer is: #include int total(int x) { int z=0; for(;x>0;x--) z=z+x; return z; } void main() { int n; double a; a=0; Printf ("please enter a positive integer n / N"); scanf("%d",&n); for(;n>0;n--) a=a+1/total(n); printf("%lf\n",a); } Then the output result should be the wrong data type

Define the function Total (n), calculate 1 + 2 + 3 +... + N, the function return type is int In the main function input positive integer n, call the function Total (n) to calculate and output the value of the following formula S=1+1/(1+2)+1/(1+2+3)+...+1/(1+2+3+...+n) My answer is: #include int total(int x) { int z=0; for(;x>0;x--) z=z+x; return z; } void main() { int n; double a; a=0; Printf ("please enter a positive integer n / N"); scanf("%d",&n); for(;n>0;n--) a=a+1/total(n); printf("%lf\n",a); } Then the output result should be the wrong data type

a=a+1.0/tota(n);