+ 1

Help finish code which should output a random number up to 10, help I do not know where is my error, help I'm a noob?!

https://code.sololearn.com/cWFy2uD0d9SM/?ref=app

1st Jun 2019, 2:07 PM
foolish
foolish - avatar
4 Réponses
+ 1
This version outputs 10 random numbers. You had a couple missing semicolons and invalid symbols https://code.sololearn.com/cxmZbpELoS4m/?ref=app
1st Jun 2019, 2:17 PM
Trigger
Trigger - avatar
+ 2
Thomas Williams Thank you very much for your help and answer 😀
1st Jun 2019, 2:33 PM
foolish
foolish - avatar
+ 1
Thomas Williams A huge thank you, please explain why you need two variables and x = rand() % 10 + 1; ?!
1st Jun 2019, 2:26 PM
foolish
foolish - avatar
+ 1
Variable x was used to hold the random number. I could even have skipped it😉 Variable d was what controlled the loop. Once d became 10 the loop would be terminated
1st Jun 2019, 2:28 PM
Trigger
Trigger - avatar