Thread: I am stuck, can somebody help me solve this problem please

  1. #1
    Registered User
    Join Date
    Mar 2013
    Posts
    15

    I am stuck, can somebody help me solve this problem please

    Code:
    I have this erro when i try to compile:
    
    In function âfâ:
    Test.c:9: error: expected expression before âdoubleâ
    Test.c:9: error: too few arguments to function âpowâ
      
    
    the source code is:------------------------>
    // it will calculate the area under the curb using the trapezoidal rule
    
    #include <stdio.h>
    #include <math.h>
    double f(int x){
            pow(double x, int 2 );
            return 0;
    }
    int main(void)
    {
            int a, b, N, width, i, sum,value, area;
            printf (" Enter the interval a an b");
            scanf ("%d\n%d", &a, &b);
            printf (" Enter the number of trapezoids you would like to use");
            scanf ("%d", &N);
            width = (b-a)/N;
            
          sum=(f(a) + f(b))/2;
            for (value = a + width; value < b; value += width)
                    sum += f(value);
            area = sum * width;
            printf (" The area under the curv is %d\n", area);
            return 0;
    }

  2. #2
    Registered User
    Join Date
    May 2009
    Posts
    4,183
    Wrong
    Code:
    pow(double x, int 2 );
    Maybe right way to call/invoke pow
    Code:
    pow(x, 2 );
    Tim S.
    "...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C++problem to solve
    By truetrini20 in forum C++ Programming
    Replies: 9
    Last Post: 06-29-2010, 03:19 AM
  2. Please help me to solve this IO problem.
    By nichya88 in forum C++ Programming
    Replies: 2
    Last Post: 01-19-2010, 12:15 PM
  3. How is it possible to solve this problem
    By ahmet858585 in forum C Programming
    Replies: 7
    Last Post: 05-01-2007, 12:28 PM
  4. problem solve
    By coolnarugodas in forum C Programming
    Replies: 7
    Last Post: 04-26-2005, 12:31 PM
  5. problem cant solve please help.
    By sarah in forum C Programming
    Replies: 6
    Last Post: 09-03-2001, 01:32 PM