Thread: Maclaurins Series

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Oct 2010
    Posts
    3

    Maclaurins Series

    Whats wrong with the following code to find maclaurin series?

    Code:
    #include <stdio.h>
    #include <math.h>
    #define TRUE 1
    #define FALSE 0
    
    int main ()
    {
        int x, n, i;
             double approx = 0;
    	/* Write your code here */
    	scanf("%d", &x);
           scanf("%d", &n);
           printf("%d", x);
           printf("%d", n);
           while (n <= 1)
     {   approx = pow(x, n);
          approx += approx;
          n++;
    }	
    while ( n > 1)
      {   		i = n;
            	while ( i > 0)
            {
               approx = (pow(x, n) * 1.0) / (i);
               approx += approx;
            	i--;
    }     
         
    }
    printf("%.10lf\n", approx);
    return 0;
    }
    Last edited by Salem; 10-05-2010 at 11:15 AM. Reason: Added code tags - learn to use them yourself

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Determining the value of a term in a series
    By jbour12 in forum C++ Programming
    Replies: 1
    Last Post: 05-03-2010, 09:28 AM
  2. Series and Parallel Circuit Calculator
    By LOBH in forum C Programming
    Replies: 1
    Last Post: 11-22-2009, 01:06 PM
  3. Implement of a Fast Time Series Evaluation Algorithm
    By BiGreat in forum C Programming
    Replies: 7
    Last Post: 12-04-2007, 02:30 AM
  4. assembly for M8 microprocessor series
    By GanglyLamb in forum Tech Board
    Replies: 3
    Last Post: 03-15-2006, 05:34 PM
  5. Problem with implementing Liebniz series
    By C_Necessity in forum C Programming
    Replies: 6
    Last Post: 06-15-2005, 12:39 PM