本文介绍了计算pi到第n个术语?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 嗨!我是编程的新手,我正试图找出最好的方法 使用循环来计算pi,比如14个术语,每次使用的值是双倍的循环。如,从1-2-4-8-16,等。我在起步的地方损失了b 。有没有人有任何想法如何做到这一点? 感谢您提供的任何帮助。 kraig 解决方案 您遇到什么问题,公式或如何编程吗? 如果您遇到公式问题那么这是一个数学问题,请在sci.math中尝试 。 如果是编程那么为什么不重复那些那些比你更好的数学公式的公式呢?这将增加你获得 答案的机会。 请注意,除非你付出了一些努力,否则这个小组不做作业 你自己,所以告诉我们你到目前为止做了什么。 如果你真的不知所措从哪里开始并且没有编程一个 行代码然后我建议你开始一个更简单的任务。忘记 关于pi并编写一个程序,使用循环输出术语1 2 4 8 16 32等14个数字。如果你不能管理那么可能编程 不适合你。 john "&的Kraig QUOT;写: 任何时候您可以提供明确的数字,例如上面的14,它是 指示该解决方案很可能包含某些 时尚的for语句。 #define PI 3.14159 double total = 0; unsigned char i; for(i = 0; i< 14; i ++) total * = PI; Hi! I''m new to programming and am trying to figure out the best wayusing loops, to compute pi to say, 14 terms using values that doubleeach time through the loop. As in, from 1-2-4-8-16, et al. I''m at aloss as to where to start. Does anyone have any ideas how to do this?Thanks for any help you can provide.kraig 解决方案What are you having trouble with, the formula, or how to program it?If you are having trouble with the formula then that''s a math question, tryin sci.math.If its the programming then why not repeat the formula for those who areless good a math then you. This will increase you chances of getting ananswer.Note that this group does not do homework unless you have made some effortyourself, so show us what you have done so far.If you really are at a loss where to start and haven''t programmed a singleline of code yet then I suggest that you start on a simpler task. Forgetabout pi and write a program that uses a loop to output the terms 1 2 4 8 1632 etc. 14 numbers in all. If you can''t manage that then maybe programmingis not for you.johnAny time you can provide an explicit number, such as 14 above, it is anindicator that the solution will most likely include a for statement in somefashion.#define PI 3.14159double total = 0;unsigned char i;for(i=0; i<14; i++)total *= PI; 这篇关于计算pi到第n个术语?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-20 04:30