All pastes #977563 Raw Edit

Unnamed

public c v1 · immutable
·published 2008-04-08 22:33 UTC
rendered paste body
//*****************************************************////////*****************************************************#include <stdio.h>#include <math.h>#define PI 3.14159void main(){	int i, x, N;	double a, b, fx, h;		x = 0;	a = (PI/4);	b = (PI/2);	//printf("a and b = %f %f,\n", a, b);	printf("How many intervals would you like to use to estimate the solution?\n");	scanf("%i", &N);		h = (b - a)/(double) N;	//printf("h = %f.\n", h);	fx = 0;	//printf("fx = %f.\n", fx);	for (i = a; i <= b; i += h)	{		fx = h * (0.5 *(i) / sin((double) i));		fx += fx;	}	printf("Solution calculated.  f(x) = %2.6lf .\n", fx);	return;}