![]() |
|
#1
|
|||
|
|||
Please help with my C program to find Pi valuesThis problem involves calculating the value of Pi from the infinite series: 4-4/3+4/5+4/7+4/9-4/11+...
I have successfully created a program that creates the values of Pi for the first eleven terms of the series. I now need to create a program that determines and prints how many terms of the series you have to use before you first get: a. 3.14? b. 3.141? c. 3.1415? d. 3.14159? e. 3.14159265358979? The program should use break and continue statements. My code is given below. Two changes I know it needs (but not sure the best way to do) are: 1. Use a larger array 2. Consider the correct number of decimal positions CPP / C++ / C Code:
Last edited by dsmith : 31-Oct-2004 at 06:27.
Reason: Please use [c] & [/c] for syntax highlighting
|
|||
|
#2
|
||||
|
||||
|
Quote:
Welcome to the forums. You initially have 3 problems 1) you didn't read the stickys about code tags to keep your formatting so your code can be read 2) you didn't use formatting so your code can be read. All your code is left-justified making it nearly impossible to follow. Check out this tutorial for some formatting guidelines. 3) Floating point values are inexact, making the statement CPP / C++ / C Code:
CPP / C++ / C Code:
__________________
During the election they said Obama could only be elected when pigs fly. Well, we currently have an epidemic of Swine Flu. Coincidence? |
Recent GIDBlog
Review: Gel laptop cooling pad by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [TUTORIAL] Calling an external program in C (Linux) | dsmith | C Programming Language | 4 | 22-Apr-2005 14:30 |
| Need help with my programs, please help. | agentxx04 | C Programming Language | 1 | 23-Sep-2004 19:02 |
| Need help with a C program (Long) | McFury | C Programming Language | 3 | 29-Apr-2004 21:06 |
| Call a C program through Linux shell script | nuwandee | C Programming Language | 3 | 29-Mar-2004 22:54 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The