Can anyone help? I have to integrate between 0 and infinity for cos(x)/sqrt(x)
Code:
#include<stdio.h>
#include<math.h>
#define PRECISION 0.001
int main()
{
float x;
float y;
float z;
float a;
float h;
printf("Enter trapezium height 'h':");
scanf("%f", &h);
x=0;
a=0;
do
{
y=(cos(x)/sqrt(x));
if (x!=0)
{
a=a+(0.5*h*(y+z));
}
(z=y);
(x=x+h);
}
while ((z<cos(x)/sqrt(x) - PRECISION) || (z>cos(x)/sqrt(x) + PRECISION));
printf("integral between 0 and infinity=%f", a);
}
All I'm getting when I run this is 1.#INF00, and I don't know what that means