i have to write a program to calculate the area under cos^2(x) but no matter what i do i keep getting 0

I've tried simplifying it down to this

but it's still always 0.Code:#include <stdio.h> #include <stdlib.h> #include <math.h> int main(int argc, char* argv[]) { FILE *input; double b; const char inp_fn[]="px270prog3a.dat"; int i; double x[10000], f[10000], integral; input = fopen(inp_fn, "r"); b=1; for(i=0; i <10000; i++) { fscanf(input, "%f %f", &x[i], &f[i]); } integral=0; for(i=0; x[i]<=b; i++) { integral += f[i-1]*(x[i]-x[i-1]); } printf("Area = %.4lf \n", integral); return(0); }

Any help?