Skip to main content

✍️ Practice (Easy)

1. Temperature​

Complete the following sample of code given the statement below and print a message when the condition is met:

If the temperature is below zero, display it's freezing.

double temperature = 3.0;

// Your answer goes here

2. Passing Grade​

Complete the following sample of code given the statement below and print a message when the condition is met:

If a student's grade is 60 or above, display that they passed; otherwise, display that they failed.

int grade = 55;

// Your answer goes here

3. Movie Rating​

Complete the following sample of code given the statement below and print a message when the condition is met:

If a person's age is under 13, display that the movie is not recommended; if their age is 13 to 17, display that parental guidance is suggested; otherwise, display that the movie is fine to watch.

int age = 15;

// Your answer goes here

4. Scholarship​

Complete the following sample of code given the statement below and print a message when the condition is met:

Display "you are eligible for a scholarship" if the age of a person is between 18 and 25 (inclusive).

int age = 19;

// Your answer goes here

5. Percentage of Increase​

Complete the following sample of code given the statement below and print a message when the condition is met:

Ensure that the percentage of increase is between -100.0 and +100.0. If it's the case, calculate the increase amount.

int stockValue = 100000;
double increasePercent = 150.0;

// Your answer goes here