Hello there. 
Just learning some C programming at Uni and am wondering how to tackle this question.
Now it's extremely simple but I didn't manage to get the answer and the solutions weren't posted up on the net so I'm just wondering. (If this isn't okay by the mods then feel free to close, but it's actually some honest revision
as opposed to 'do my homework' please)
How do I go about completing that?
I'm sort of complicating it for myself by thinking the following but I suppose I'll have a go and see what comes of it:
Is that anywhere near right or completely retarded?
I'm really not sure but would appreciate some help, even if it is simple in terms of the overall reach of the language.
Thanks.

Just learning some C programming at Uni and am wondering how to tackle this question.
Now it's extremely simple but I didn't manage to get the answer and the solutions weren't posted up on the net so I'm just wondering. (If this isn't okay by the mods then feel free to close, but it's actually some honest revision

Code:
Question 1
Complete the following ‘C’ program that calculates the total cost of 10 pencils.
#include <stdio.h>
void main (void) {
[COLOR="Red"] int numpencils;
float unitcost;[/COLOR]
[COLOR="Lime"] numpencils = 10;
unitcost = 0.25;[/COLOR]
printf("Total cost of %d pencils at £%.2f each is £%.2f\n",
numpencils, unitcost, [COLOR="Yellow"]/* Insert code here */[/COLOR]);
}
How do I go about completing that?
I'm sort of complicating it for myself by thinking the following but I suppose I'll have a go and see what comes of it:
- float total; (added onto)
- total = numpencils*unitcost; (added onto)
- total (instead of)
Is that anywhere near right or completely retarded?
I'm really not sure but would appreciate some help, even if it is simple in terms of the overall reach of the language.

Thanks.