返回列表 發帖
  1. import java.util.Scanner;
  2. public class JPA03 {
  3.     static Scanner keyboard = new Scanner(System.in);
  4.     static int i = -1;
  5.     public static void main(String[] args) {
  6.         int total = 0, s = 0;
  7.         

  8.       
  9.       do{
  10.               total+=s;
  11.               System.out.print("請輸入消費金額,或輸入-1結束: ");
  12.               s=keyboard.nextInt();
  13.       }while(s!=-1);
  14.       
  15.     }
  16. }
複製代碼

TOP

返回列表