//Lab1.c

#include <stdio.h>
#include <conio.h>
#include <math.h>

double t;
double total;
double i = 0;
double foo;

double f(double t)
	{
	foo = 5*t + (sin((9*t)-5)/t);
	return foo;
	}

void main(void)
	{
	double start, end, delta_t;
	int steps;
	
	fflush(stdin);
	printf("Enter a number for the start value.\n");
	scanf("%lf",&start);
	fflush(stdin);
	printf("Enter a number for the end value.\n");
	scanf("%lf",&end);
	fflush(stdin);
	printf("Enter a number for the step value.\n");
	scanf("%d",&steps);
	
	total = 0;
	delta_t = (end-start)/steps;

	for (i = 0; i < steps; i += 1)
		{
		t = start + i*delta_t;
		total = total + f(t);
		}
	total = total * delta_t;
	printf("Rectangular integration value %f.\n",total);
	getch();
	}
