pretend you're the computer: write out pseudocode as a line by line step of how you would try to do the problem. You're seriously not even trying, at least show us you tried to come up with a method to solve this. Even if you have no idea how.
Seriously I wish I had the discipline to write pseudocode when I started out. You'll be lightyears ahead if you train yourself to do that.
widgets:
A small box would be in the 1-4 range
a medium box would be in the 5-6 range
a large box would be in the 7-10 range
foam:
small box: 4-number entered
medium box: 6-number entered
large box: 10-number entered
how do i tell the computer which number represents which box and how do i have the computer keep track during the looping program?
int num_widgets=0;
printf("How many widgets do you need shipped?");
scanf("%d",&num_widgets);
int num_large_boxes,num_med_boxes,num_small_boxes = 0;
if(num_widgets<=4)
{
num_small_boxes=1;
printf("One small box was used\n");
printf("%d blocks of foam were used.\n",4-num_widgets);
}
elseif(num_widgets<=6)
{
num_medium_boxes=1;
printf("One medium box was used\n");
printf("%d blocks of foam were used.\n",6-num_widgets);
}
elseif(num_widgets<=10)
{
num_large_boxes=1;
printf("One large box was used\n");
printf("%d bloxks of foam were used.\n",10-num_widgets);
}
else
{
num_large_boxes = num_widgets / 10;
int num_rest = num_widgets % 10;
//then the same if/else if/else:
if((num_rest<=6)&&(num_rest>0))
{
num_medium_boxes=1;
num_rest=num_rest-6;
}
if((num_rest<=4)&&(num_rest>0))
{
num_small_boxes=1;
num_rest=num_rest-4;
}
int foam_used = (10*num_large_boxes) + (6*num_medium_boxes)+(4*num_small_boxes) - num_widgets;
//do whatever
}
//maybe some other stuff
I don't know if this will completely answer your question but there is enough there so you can research or figure out the rest.