All pastes #977566 Raw Edit

Untitled

public text v1 · immutable
·published 2008-04-08 22:35 UTC
rendered paste body
//*********************************************
//
//
//
//*********************************************

#include <stdio.h>
#include <math.h>

#define PI 3.14159

void main ()
{
	int N; 
	double h, i, solution, a, b, fx;
	a=PI/4;
	b=PI/2;

	printf("How many intervals would you like to use to estimate the solution?");
	scanf("%i", &N);

	h=((b-a)/N);

	for(i=a; i<=b; i += h)
	{
		fx=(h*((0.5*i)/sin(i)));
		fx += fx;
	}

	printf("\n");
	printf("The approximate estimate is: f(x)=%2.16f/\n", fx);
	printf("\n");

	return;
}