/*
	Prelab 3
	C program used to calculate the area under the curve of the function
	By: John Fountain
*/



#include <stdio.h>
#include <math.h>


float 	t_start;
float  	t_end;
float 	t_delta;
float 	h;
float 	total;
float   t;
int 	i;



int main()
{

	printf("Enter a value for the start time:  \n");
	
	fflush(stdin); scanf("%f", &t_start);

	printf("Enter a value for the end time:  \n");

	fflush(stdin); scanf("%f", &t_end);

	printf("Enter a value for the number of steps:  \n");
	
	fflush(stdin); scanf("%f", &h);

	t_delta = (t_end - t_start)/h;

	for( i = 1; i < h; i++)
	{
		t = t_start + i*t_delta;

		total = total + (5*t + (sin(9*t - 5))/t)*t_delta;		
				
	}
	

	printf("\ntotal for rectangular sum=  %f\n", total);

	return 0; 
}
