import java.util.Scanner;
public class JPD05 {
public static Scanner keyboard = new Scanner(System.in);
public static void main(String args[]) {
System.out.print("請輸入學生人數:");
}
}作者: 巫沛庭 時間: 2018-9-18 19:40
package text;
import java.util.Scanner;
public class JPA05 {
public static Scanner keyboard = new Scanner(System.in);
public static void main(String args[]) {
System.out.print("請輸入學生人數:");
int num=keyboard.nextInt();
double n[]=new double[num];
double sum=0;
for(int i=0;i<num;i++)
{
System.out.print("第"+(i+1)+"個學生的成績:");
n[i]=keyboard.nextDouble();
sum+=n[i];
}
System.out.println("人數: "+num);
System.out.println("總分: "+sum);
System.out.println("平均: "+sum/num);
}
}
複製代碼
作者: 張閎鈞 時間: 2018-9-18 19:48
package hi87;
import java.util.Scanner;
public class hi78 {
public static Scanner keyboard = new Scanner(System.in);
public static void main(String args[]) {
System.out.print("請輸入學生人數:");
int num=keyboard.nextInt();
double n[]=new double[num];
double sum=0;
for(int i=0;i<num;i++)
{
System.out.print("第"+(i+1)+"個學生的成績:");
n[i]=keyboard.nextDouble();
sum+=n[i];
}
System.out.println("總分: "+sum);
System.out.println("人數: "+num);
System.out.println("平均: "+sum/num);
}
}
複製代碼
作者: 巫晉宇 時間: 2018-9-18 20:16
import java.util.Scanner;
public class JPD04 {
static Scanner k = new Scanner(System.in);
public static void main(String args[]) {
int x ;
System.out.println("請輸入學生人數 :");
x=k.nextInt();
double a[]=new double[x];
double s = 0;
int p = 0;