#include <
stdio.h>
int main() {
double s = 0.0;
int n = 1;
double t = 1.0/n;
while (t<0.00001) {
s+=t;
n+=2;
t = 1.0/n;
}
printf("%.6f\n", s);
return 0;
}
追问![](https://video.ask-data.xyz/img.php?b=https://iknow-pic.cdn.bcebos.com/83025aafa40f4bfb4a9a9166044f78f0f73618bd?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_600%2Ch_800%2Climit_1%2Fquality%2Cq_85%2Fformat%2Cf_auto)
追答化简:2式-1式: 2y+4z =57, 即2(y+2z) = 57, y,z都是正整数的情况下,显然不成立。
所以,这个方程组,没有正整数解。
由1式,x,y,z取值均在 [1,29]之间
由2式,x [1,80], y [1,27], z[1, 16]
程序:
#include <stdio.h>
int main() {
int x, y, z;
for (x=1;x<30;x++) {
for (y=1;y<28;y++) {
for (z=1;z<17;z++) {
if (x+y+z==31 && x+ 3*y+5*z==88)
printf("x=%d, y=%d, z=%d\n", x, y, z);
}
}
}
return 0;
}本回答被提问者采纳