Need to take in two variable ranges, 3 to 6 and 1 to 4. The program is supposed to calculate the cubed value of the ranges (432 & 100). I have written the functions and they work fine but I can't accumulate the totals! At the moment it is returninf the cubed values for the last digit of each range (54 & 36). Probably something really easy but I'm stuck! Here is the code:

#include<stdio.h>

#include<conio.h>

main()

{

int firsta,

lasta, /* first range */

firstb,

lastb, /*second range */

rangea,

rangeb;

int sum_of_cubes (int, int);

printf("Enter first range : ");

scanf("%d%d", &firsta, &lasta);

printf("Enter second range: ");

scanf("%d%d", &firstb, &lastb);

rangea = sum_of_cubes (firsta, lasta);

rangeb = sum_of_cubes (firstb, lastb);

printf("first range cubed %d\nsecond range cubed %d", rangea, rangeb);

getch();

}

int sum_of_cubes (int first, int last)

{

int number = first,

sum = 0,

parameter,

total;

int cube (int);

while (number <= last)

{

/* this is the bit I'm stuck on!!

parameter = cube(number);

sum = parameter;

number += 1;

*/

}

return sum;

}

cube (int item)

{

return item *3 *3;

}