Home > Back-end >  c
c

Time:11-11

Design a program, and satisfy the following conditions, the minimum value of the value of n and s,
S=1 + 1/2 + 1/3 +... A + 1/n, and the s>=30, the new c + +, the bosses help, not really,

CodePudding user response:

If there is a convergence s value, and the convergence value under the premise of not less than 30, you can use the following code
Int main () {
Double s=0, n=1;
While (s<30) {
S +=1/n;
N++;
}
Coutreturn 0;
}