计算pi到第n个术语?

编程入门 行业动态 更新时间:2024-10-18 14:14:15
本文介绍了计算pi到第n个术语?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

嗨!我是编程的新手,我正试图找出最好的方法 使用循环来计算pi,比如14个术语,每次使用的值是双倍的循环。如,从1-2-4-8-16,等。我在起步的地方损失了b 。有没有人有任何想法如何做到这一点? 感谢您提供的任何帮助。 kraig

解决方案

" Kraig" < TS ***** @ gmail>在消息中写道 news:zm ******************** @ bignews6.bellsouth ...

嗨!我是编程的新手,我正试图找出使用循环的最佳方法,使用每次循环两倍的值来计算pi,即14个术语。如,从1-2-4-8-16,等。我不知道从哪里开始。有没有人有任何想法如何做到这一点?感谢您提供的任何帮助。 kraig

您遇到什么问题,公式或如何编程吗? 如果您遇到公式问题那么这是一个数学问题,请在sci.math中尝试 。 如果是编程那么为什么不重复那些那些比你更好的数学公式的公式呢?这将增加你获得 答案的机会。 请注意,除非你付出了一些努力,否则这个小组不做作业 你自己,所以告诉我们你到目前为止做了什么。 如果你真的不知所措从哪里开始并且没有编程一个 行代码然后我建议你开始一个更简单的任务。忘记 关于pi并编写一个程序,使用循环输出术语1 2 4 8 16 32等14个数字。如果你不能管理那么可能编程 不适合你。 john

"&的Kraig QUOT;写:

嗨!我是编程的新手,我正试图找出使用循环的最佳方式来计算pi,比如14个术语使用每次循环加倍的值。如,从1-2-4-8-16,等。我不知道从哪里开始。有没有人有任何想法如何做到这一点?感谢您可以提供的任何帮助。

任何时候您可以提供明确的数字,例如上面的14,它是 指示该解决方案很可能包含某些 时尚的for语句。

Kraig < TS ***** @ gmail>在消息中写道 news:zm ******************** @ bignews6.bellsouth ...

嗨!我是编程的新手,我正试图找出使用循环的最佳方法,使用每次循环两倍的值来计算pi,即14个术语。如,从1-2-4-8-16,等。我不知道从哪里开始。有没有人有任何想法如何做到这一点?感谢您提供的任何帮助。 kraig

#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 way using loops, to compute pi to say, 14 terms using values that double each time through the loop. As in, from 1-2-4-8-16, et al. I''m at a loss as to where to start. Does anyone have any ideas how to do this? Thanks for any help you can provide. kraig

解决方案

"Kraig" <ts*****@gmail> wrote in message news:zm********************@bignews6.bellsouth ...

Hi! I''m new to programming and am trying to figure out the best way using loops, to compute pi to say, 14 terms using values that double each time through the loop. As in, from 1-2-4-8-16, et al. I''m at a loss 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, try in sci.math. If its the programming then why not repeat the formula for those who are less good a math then you. This will increase you chances of getting an answer. Note that this group does not do homework unless you have made some effort yourself, so show us what you have done so far. If you really are at a loss where to start and haven''t programmed a single line of code yet then I suggest that you start on a simpler task. Forget about pi and write a program that uses a loop to output the terms 1 2 4 8 16 32 etc. 14 numbers in all. If you can''t manage that then maybe programming is not for you. john

"Kraig" write:

Hi! I''m new to programming and am trying to figure out the best way using loops, to compute pi to say, 14 terms using values that double each time through the loop. As in, from 1-2-4-8-16, et al. I''m at a loss as to where to start. Does anyone have any ideas how to do this? Thanks for any help you can provide.

Any time you can provide an explicit number, such as 14 above, it is an indicator that the solution will most likely include a for statement in some fashion.

"Kraig" <ts*****@gmail> wrote in message news:zm********************@bignews6.bellsouth ...

Hi! I''m new to programming and am trying to figure out the best way using loops, to compute pi to say, 14 terms using values that double each time through the loop. As in, from 1-2-4-8-16, et al. I''m at a loss as to where to start. Does anyone have any ideas how to do this? Thanks for any help you can provide. kraig

#define PI 3.14159 double total = 0; unsigned char i; for(i=0; i<14; i++) total *= PI;

更多推荐

计算pi到第n个术语?

本文发布于:2023-11-30 04:29:10,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1648728.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:到第   术语   pi

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!