问题描述
第2部分的目标是开发一种算法并实现代码来计算倒数的串联和S(n)=(1/1 + 1/2 + 1/3 + 1/4 + ... + 1 / n )使你的程序找到最小数字n,其系列倒数之和S(n)等于或超过用户输入的值。
例如,如果用户输入1.5,您的程序应显示以下内容:
最小的系列总和> = 1.5是S(2),其值为1.5。
我尝试过的事情:
我已经尝试过我所知道的所有事情并且可以'似乎让输出正确。
The goal of Part 2 is to develop an algorithm and implement code to calculate the series sum of reciprocals S(n) = (1/1 + 1/2 + 1/3 + 1/4 + … + 1/n) such that your program finds the smallest number n for which the series sum of reciprocals S(n) EQUALS OR EXCEEDS a value entered by the user.
For example, if the user enters 1.5 your program should display the following:
The smallest series sum >= 1.5 is S(2) which has the value 1.5.
What I have tried:
I have tried everything I know and can't seem to get the output to be correct.
推荐答案
这篇关于S(n)=(1/1 + 1/2 + 1/3 + 1/4 + ... + 1 / n)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!