Skip to main content

✍️ Practice (Medium)

1. Ascending​

Given two numbers, print them in ascending order (smallest first).

int num1 = 8;
int num2 = 3;

// Your answer goes here

2. Temperature Ranges​

Write a program which asks the user for the temperature. The program prints a different message for each of the following conditions:

  • above 25: it's hot outside
  • 25 or below, but above 15: it's pretty warm outside
  • 15 or below, but 0 or above: it's pretty chill outside
  • below 0: it's freezing outside

3. Arcane​

⚠️ For those who never watched this before, you have homework

I can binge Arcane if I answered all my emails by 5pm and the internet is working, otherwise if I still have emails left, I’ll answer those instead. If the internet’s down tho, I’ll probably need to call hydro quebec lol.

4. Oil Change​

Print "Change your car oil" if a car's mileage exceeds 5000 km or it's been more than 3 months since the last oil change. Additionally, there must be at least $80.00 of savings.

double savings = 120.00;
int mileage = 5400;
int months = 2;

// Your answer goes here

5. Ascending (Again)​

Given three numbers, print them in ascending order (smallest first). Try to do it without nesting any if statements.

int num1 = 8;
int num2 = 3;
int num3 = 5;

// Your answer goes here