/* ------------------------------------------------------------------- Modular programming: Programming with a purpose ("rebel with a clue") ------------------------------------------------------------------- */ float RectangleRule(float f(float), float a, float b, int N) { float integral, h, x; int i; integral = 0.0; h = (b-a)/N; x = a; for (i = 1; i <= N; i = i + 1) { integral = integral + f(x)*h; x = x + h; } return(integral); }