While loop/ rand()

Use a while loop to write a program that calculates the sum of N integers entered by the user. N is a computer generated random number between 5 and 15.

Can anyone help??

Thanks
Thank you for the links. The way I was thinking to generate the random numbers between 5 & 15 was: randNum = (rand() % 11) +5;

However, I keep getting 13 as the random number, hence not random. Is there something wrong with that line?
No the code is right. You need to call srand once to get random numbers.
Such as:
srand(time(NULL)); //?

As for the "for statement", I have for(i = 0; i < count; i = i + 1) {

Would the count in this case be randNum or whatever I assign the random number to be?

Sorry for all the questions I'm only one month into coding.
Why not just post the code you have so far? It is easier for us to comment on a known code base than to comment on what we assume you have written.

Start by clicking the Format button that looks like "<>". This will create code tags in the text box. Copy your code from your editor and paste it between the code tags.
Topic archived. No new replies allowed.