Thread: Program not giving any error/return value/output, help please!

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Sep 2012
    Posts
    14
    Just looked at that link, but I don't understand the codes you guys post at all.

  2. #2
    SAMARAS std10093's Avatar
    Join Date
    Jan 2011
    Location
    Nice, France
    Posts
    2,694
    Quote Originally Posted by jackel View Post
    Just looked at that link, but I don't understand the codes you guys post at all.
    well ok..this was the code we wrote when we started coding
    Code:
    /* File: picomp.c */
    #include <stdio.h> /* Header file for standard I/O library */
    #include <math.h> /* Header file for math library */
    int main(void)
    { 
         long i;
         double sum, current, pi;
         i = 1; /* Denominator of current term */
        sum = 0.0; /* So far sum */
       do {
           current = 1/(((double) i)*((double) i)); /* Current term */
           sum = sum+current; /* Add current term to sum */
           i++; /* Next term now */
       } while (current > 1.0e-15); /* Stop if current term is very small */
       pi = sqrt(6*sum); /* Compute approximation of pi */
       printf("Summed %8ld terms, pi is %10.8f\n", i-1, pi);
    }
    I posted the code in order you to get another perspective of it
    Do not even think of copy pase the code ,this will be bad for you and very sad for me :/ :/

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Why is this giving me this output?
    By mgracecar in forum C Programming
    Replies: 4
    Last Post: 03-16-2012, 12:51 PM
  2. Replies: 4
    Last Post: 12-23-2011, 08:56 AM
  3. Replies: 4
    Last Post: 07-07-2011, 02:33 AM
  4. output screen isn't giving proper result
    By time4f5 in forum C Programming
    Replies: 11
    Last Post: 03-22-2011, 01:34 AM
  5. structure giving weird output
    By bluetxxth in forum C Programming
    Replies: 7
    Last Post: 02-14-2010, 11:44 PM