Hey guys,
I'm new to programming and I'm not sure why this program won't work. As soon as I enter the value of a on the console the rest of the program just won't run. I'm sure I'm just being stupid. Any help would be appreciated. Thanks.
Code:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
float integral(int n, int a);
int main(int argc, char* argv[])
{
int n, a;
printf("Enter your integer value of a: ");
scanf("%i", &a);
for (n = 1; n <= 10; n++)
{
printf("%i %g\n", n, integral(n, a));
}
return 0;
}
float integral(int n, int a)
{
int N = 10000;
float x, y, strip, sum;
for(x = 0; x < 1; x=x+(1/N))
{
y = (pow(x,n))/(x+a);
strip = y/(N);
sum += strip;
}
return(sum);
}