Code:
while(numberRolls != 10) {
for(numberRolls = 0; numberRolls < 10; numberRolls++);
printf("Dice roll %d was %d and %d.\n", numberRolls, die1, die2);
}
While loops are an alternative to for loops, particularly useful when you have no idea how many times the program needs to loop.
In your case, delete the while loop (it's useless), and just use the for loop. In order for the for loop to work, you need to remove the semi-colon from the end of it's first line of code:
Code:
for(numberRolls = 0; numberRolls < 10; numberRolls++);
You never want a semi-colon on the end of a for loops first line (never is a very long time OK, but let's go with that anyway).
You need logic inside your for loop. Imagine that you were doing this at the kitchen table. How would you do it? What would you need to keep track of, and what kind of data would that be?
Make notes (on paper or mentally) of your steps to do something, and you'll have a way to code up a lot of problems in real life.
What would you suggest here, for inside your for loop?