5-1的編程練習(xí)是無法使用Scanner嗎
import java.util.Scanner;
public class HelloWorld {
??? public static void main(String[] args) {
??????? System.out.println("請輸入你的成績:");
??????? Scanner input=new Scanner(System.in);
??????? int score = input.nextInt();
??????? int count = 0;
?
?System.out.println("加分前成績:"+score);
??????? //打印輸出加分前成績
????????? while (score<60){
????????????? score++;
????????????? count++;
????????? }
?????
???????? System.out.println("加分后成績:"+score);
????????? System.out.println("共加了"+count+"次!");
??? }
}
2019-07-31
沒錯,可以運(yùn)行,,,