import java.util.Scanner;
public class Main {
? ? public static void main(String[] args) {
? ? ? ? Scanner scanner = new Scanner(System.in);
? ? ? ? int score = scanner.nextInt();
? ? ? ?
? ? ? ? String result = score < 60 ? "不及格" : "通過了考試";
? ? ? ? System.out.println(result);
? ? }
}
import java.util.Scanner;
public class Main {
? ? public static void main(String[] args) {
? ? ? ? Scanner scanner = new Scanner(System.in);
? ? ? ? int score = scanner.nextInt();
? ? ? ?
? ? ? ? if (score >= 90) {
? ? ? ? ? ? System.out.println("優(yōu)秀");
? ? ? ? } else if (score >= 80) {
? ? ? ? ? ? System.out.println("優(yōu)良");
? ? ? ? } else if (score >= 60) {
? ? ? ? ? ? System.out.println("中等");
? ? ? ? } else {
? ? ? ? ? ? System.out.println("不及格");
? ? ? ? }
? ? }
}
import java.util.Scanner;
public class Main {
? ? public static void main(String[] args) {
? ? ? ? Scanner scanner = new Scanner(System.in);
? ? ? ? String signal = scanner.next();
? ? ? ?
? ? ? ? switch (signal) {
? ? ? ? ? ? case "紅":
? ? ? ? ? ? ? ? // 根據(jù)路況情況,選擇執(zhí)行stop或go
? ? ? ? ? ? ? ? System.out.print("有交警嗎?(輸入y/n)");
? ? ? ? ? ? ? ? String police = scanner.next();
? ? ? ? ? ? ? ? switch (police) {
? ? ? ? ? ? ? ? ? ? case "y":
? ? ? ? ? ? ? ? ? ? ? ? System.out.println("stop");
? ? ? ? ? ? ? ? ? ? ? ? break;
? ? ? ? ? ? ? ? ? ? case "n":
? ? ? ? ? ? ? ? ? ? ? ? System.out.println("go");
? ? ? ? ? ? ? ? ? ? ? ? break;
? ? ? ? ? ? ? ? ? ? default:
? ? ? ? ? ? ? ? ? ? ? ? System.out.println("call police");
? ? ? ? ? ? ? ? ? ? ? ? break;
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? break;
? ? ? ? ? ? case "綠":
? ? ? ? ? ? ? ? System.out.println("go");
? ? ? ? ? ? ? ? break;
? ? ? ? ? ? case "黃":
? ? ? ? ? ? ? ? System.out.println("wait");
? ? ? ? ? ? ? ? break;
? ? ? ? ? ? default:
? ? ? ? ? ? ? ? System.out.println("call police");
? ? ? ? ? ? ? ? break;
? ? ? ? }
? ? }
}
public class Main {
? ? public static void main(String[] args) {
? ? ? ? for (int i = 1; i <= 100; i++) {
? ? ? ? ? ? if (i % 5 == 0 && i % 6 == 0) {
? ? ? ? ? ? ? ? System.out.println(i);
? ? ? ? ? ? }
? ? ? ? }
? ? }
}
public class Main {
? ? public static void main(String[] args) {
? ? ? ? for (int i = 1; i <= 9; i++) { // 外層循環(huán)控制行數(shù)
? ? ? ? ? ? for (int j = 1; j <= i; j++) { // 內(nèi)層循環(huán)控制每行的列數(shù)
? ? ? ? ? ? ? ? System.out.print(j + "*" + i + " = " + (i * j) + "? "); // 輸出乘法表達式和結(jié)果
? ? ? ? ? ? }
? ? ? ? ? ? System.out.println(); // 每輸出一行后,換行
? ? ? ? }
? ? }
}