005-002-005
If-Else Statement: Pass or Fail
Easy
Problem Description
If-Else Statement: Pass or Fail
Learning Objective: Learn conditional branching with if-else statement
Overview
Let's create a program that determines pass or fail based on test score. 60 or above is a pass!
Specifications
- Initialize integer variable
scoreto 75 - Display "Pass" if 60 or above
- Display "Fail" if below 60
Output Format
Pass
Test Cases
※ Output examples follow programming industry standards
Input:
Expected Output:
Pass
❌ Some tests failed
Your Solution
Current Mode:● My Code
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
›
⌄
⌄
⌄
⌄
public class Main {
// メインメソッドを定義
public static void main(String[] args) {
// コピー: 値 の 75 into スコア (pass により 値)
int score = 75;
// if スコア は 大きい より または 等しい まで 60をチェック
if (score >= 60) {
System.out.println("Pass");
} else { // 条件が満たされない場合を処理
System.out.println("Fail");
}
}
}
0 B / 5 MB
You have 10 free executions remaining
