Solution Review: Oven is Ready

Let’s go over the solution for the challenge: Oven is Ready!

We'll cover the following

Task

In this challenge, you were given the initial temperature of an oven. The oven needed to be 375o for it to be ready. You checked on it after some time and increased it by 25o if the oven had not reached the required 375o.

Solution

Let’s go over the solution step-by-step.

  • The first thing you had to figure out is that the program must run until the oven reaches 375o. This means we require a while loop which had the condition:
while (temperature < 375)
  • Next, you had to increase the temperature by 25o and increment count by 1.
temperature += 25;
count +=1;

You can find the complete solution below:

You were required to write the code given from line 5 to line 8.

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy