005-001-013

Basic If Statement

Easy

Problem Description

Basic if statement

In this problem, you will create a program that reads an int score from standard input, evaluates multiple if statement conditions, and displays the corresponding messages to standard output.

Learning Objective: Understand the basics of conditional branching with if statements in Java

Overview

The if statement executes code only when a condition is true. The condition must evaluate to a boolean value.

Specifications

  • Read an int score from standard input
  • If score is 80 or above, display "Excellent"
  • If score is 60 or above, display "Good"
  • If score is 0 or above, display "Score is valid"

Input Format

score (integer)

Output Format (when score=85)

Excellent
Good
Score is valid

Ready to Try Running Code?

Log in to access the code editor and execute your solutions for this problem.

Don't have an account?

Sign Up