import java.util.Scanner;
public class JPD03 {
static Scanner keyboard = new Scanner(System.in);
static int i = -1;
public static void main(String[] args) {
int total = 0, s = 0;
...
}
}作者: 張閎鈞 時間: 2018-7-24 19:19
package HI87;
import java.util.Scanner;
public class hi78 {
static Scanner keyboard = new Scanner(System.in);
public static void main (String argv[]){
int i=0;
int k=0;
do
{
k=k+i;
System.out.print("請輸入消費金額<或數入-1結束:");
i=keyboard.nextInt();
}while(i!=-1);
System.out.print("電腦週邊總消費:"+k);
}
}
複製代碼
作者: 巫沛庭 時間: 2018-7-24 19:23
import java.util.Scanner;
public class JPA03 {
static Scanner keyboard = new Scanner(System.in);
static int i = -1;
public static void main(String[] args) {
int total = 0, s = 0;
do{
total+=s;
System.out.print("請輸入消費金額,或輸入-1結束: ");
s=keyboard.nextInt();
}while(s!=-1);
}
}
複製代碼
作者: 巫晉宇 時間: 2018-7-24 19:28
package sdasda;
import java.util.Scanner;
public class dwaadw {
static Scanner e=new Scanner(System.in);
public static void main(String[] args) {
int t = 0, o = 0;
do
{
t+=o;
System.out.println("請輸入消費金額,或輸入-1結束:");
o=e.nextInt();