Here is a definition that includes a comment explaining what it is doing. You are not required to include such a comment.
int sum(int a, int b)
{
int s = 0;
int k = a;
//------------------------------------------------------------
// Every time the program reaches the top of the following loop,
// s = the sum of all integers that are greater than or
// equal to a and strictly less than k
// (So s = a + ... + (k-1).)
//------------------------------------------------------------
while(k <= b)
{
s = s + k;
k = k + 1;
}
return s;
}