Time to Code
Let’s implement the game!
We'll cover the following
Note: To test your logic and implementation for all the tasks in this lesson, write your code within the commented block. In the code widget, replace
/* Write your code here */
with your code. To run the program, click the “Run” button.
Task I: Generate the secret number
Our task is to generate a random number between 0 and 100 (inclusive). We’ve already created and initialized an int
variable secret_number
. We’ll update its value from 0
to the random number we’ll generate.
Get hands-on with 1400+ tech skills courses.