#include <stdio.h>

#define MAX_FORMULA_SIZE 100

int main( void ) {

char formula[100];
int lower;
int upper;
int partitions;
double move;
int x;
double width;
double length;
double answer;

printf("Enter formula in terms of x: ");
scanf("%s", &formula);

printf("Enter lower number: ");
scanf("%i", &lower);

printf("Enter upper number: ");
scanf("%i", &upper);

printf("Enter number of partitions from %i to %i: ", lower, upper);
scanf("%i", &partitions);

move = (upper - lower) / partitions;

for(x = lower; x <= upper; x += move) {
width = move;
length = formula;
answer += (width * length);

printf("ANSWER: %f", answer);

return 0;

i want the counter variable "x" to be entered into the formula each time and calculate the answer... how do i do this? thanks.