All pastes #977618 Raw Edit

Anonymous

public text v1 · immutable
·published 2008-04-08 23:14 UTC
rendered paste body
#include <stdio.h>
#include <math.h>

#define PI 3.14159

void main()
{
	double i, N, a, b, fx, h, h_int;
	
	
	a = PI/4;
	b = PI/2;
	
	printf("How many intervals would you like to use to estimate the solution?\n");
	scanf("%f", &N);
	
	printf("a and b = %f %f,\n", a, b);
	h = (b - a);
	h_int = h/N;
	printf("h = %3.5f.\n", h);
	printf("h_int = %.6f.\n\n\n", h_int);
	fx = 0;
	printf("fx = %f.\n", fx);
	i = 0;
	printf("PI = %1.5f\n", PI);
	printf("i = %f\n, a = %f\n, b = %f\n, h = %f\n", i, a, b, h);
	for (i = a; i <= b; i += h)
	{
		printf("i = %f, a = %f, b = %f, h = %f\n", i, a, b, h);
		break;
		fx = (h * ((0.5 *i) / sin(i)));
		fx += fx;
	}
	
	printf("Solution calculated.  f(x) = %2.6lf .\n", fx);
	
	return;
}