Every C program starts like this....
Code:
int main (void)
{
return 0; }
From there you fill in the blanks.... Look up the C modulous operator .. % . Your program will also have to divide and add...
You can't code a solution until you understand the problem. Sit down with a pen and paper --yeah old school but still very effective-- work out the steps you have to perform to solve the problem. From there take out everything you don't absolutely need to get the right answer... and then you will be ready to start coding; once you understand the problem itself and how to solve it.
Get your code as far along as you can... and if you run into problems, post it here (in code tags, please) and ask specific questions. I and likely several others will be happy to help so long as you are showing some intiative of your own.