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;
}