003-002-013

Conditional Expressions with Ternary Operator

Medium

Problem Description

Conditional Expressions with Ternary Operator

Learning Objective: Understand how to write concise conditional expressions using ternary operator (?:)

Overview

Use ternary operator to select values based on conditions.

Specifications

  • Initialize integer score with 75
  • Use ternary operator to determine "Pass" if 60 or above, "Fail" if below
  • Implement finding maximum using ternary operator

Output Format

Score 75: Pass
Max of 10 and 25: 25

Ready to Try Running Code?

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

Don't have an account?