2023-04-18 - 草稿

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(); // 每輸出一行后,換行

? ? ? ? }

? ? }

}

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • 2019年8月8日開始編寫,等50題做完了希望不會太晚。 本篇純屬本人的練手作業(yè),本人也不是什么大神,僅供參考。 ...
    墨鳶Wesley閱讀 936評論 0 0
  • 1 順序語句 語句:使用分號分隔的代碼稱作為一個語句。 注意:沒有寫任何代碼只是一個分號的時候,也是一條語句,...
    哈哈哎呦喂閱讀 473評論 0 0
  • 第一章 初識javaJAVA 第一講:什么是程序?:為了讓計算機執(zhí)行某些操作或解決某個問題而編寫的一系列有序指令的...
    人子日月幾點閱讀 592評論 0 1
  • Day01 class 例子{ public static void main(String[] args){ ...
    周書達閱讀 1,214評論 0 0
  • 企業(yè)發(fā)放的獎金根據(jù)利潤提成。利潤低于或等于10萬元時,獎金可提10%;利潤高于10萬元,低于20萬元時,低于10萬...
    遼A丶孫悟空閱讀 896評論 0 16

友情鏈接更多精彩內(nèi)容