JAVA-求三门课平均成绩

时间:2024-05-21 09:23:50
import java.util.Scanner;
public class Jpro1 {
 public static void main(String[] args) {
  // TODO Auto-generated method stub
  int chinese , english,  math;
  float ave;
 /* chinese=30;
  english=50;
  math=90;*/
  System.out.println("请输入chinese成绩");
  Scanner ch=new Scanner(System.in);
  chinese=ch.nextInt();
  System.out.println("请输入english成绩");
  Scanner en=new Scanner(System.in);
  english=en.nextInt();
  System.out.println("请输入math成绩");
  Scanner ma=new Scanner(System.in);
  math=ma.nextInt();
  ave=(chinese+english+math)/3;
  System.out.println ("score of three courses is "+chinese+","+english+","+math);
  System.out.println("The average score is:"+ave);
  
  }
}

JAVA-求三门课平均成绩

JAVA-求三门课平均成绩