Your question is a little unclear, but if you are asking how to do this in C then here is a sample program:
int main (int argc, char *argv)
while( total >= 0)
printf("Total = %d after adding rnum of %d\n",total,rnum);
And I have....