Code:
new to programming in c and my task is to write a simple program that is able to compute the area under a curb using the trapezoidal rule. I wrote the program but it will not compile, the error I m getting is:
expected expression before â}â token
project1.c:24: error: expected â;â before numeric constant
and this are my codes:
#include <stdio.h>
int main(void)
{
int a, b, N,h,i,counter,A;
printf(" enter the interval a and b");
scanf("%d\n%d\n", &a, &b);
prinf("enter the number of trapezoids you would like to use");
scanf("%d\n", &N);
h= (b-a)/N;
while((h*((i*i)+(counter*counter))/N) <= N){
for(i=a; i<=b; i++)
for(counter=a; counter=b; counter++){
A=(h*((i*i)+(counter*counter))/2);
}
printf("the area under the curb from %d to %d is: %d", a, b, A);
counter 0;
}