005-002-008
If-Else Statement: Pass/Fail Check
Medium
Problem Description
If-Else Statement: Pass/Fail Check
In this problem, you will create a program that reads a test score, determines whether it is 60 or higher using an if-else statement, and displays either "Pass" or "Fail" along with the score to standard output.
Learning Objective: Write two-way branching using if-else statements
Create a program to input test score and determine pass or fail. Use if-else statement for conditional branching.
Input
Line 1: Score (integer, 0-100)
Output
- If 60 or higher: "Pass: [score] points"
- If below 60: "Fail: [score] points"
Examples
Example 1
Input:
75
Output:
Pass: 75 points
Example 2
Input:
45
Output:
Fail: 45 points
Example 3
Input:
60
Output:
Pass: 60 points
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