Discuss / Java / 成绩

成绩

Topic source
Scanner scanner = new Scanner(System.in);System.out.print("上次考核成绩: ");int first = scanner.nextInt();System.out.print("本次考核成绩: ");int current = scanner.nextInt();float r = (float) (current - first) / first * 100;System.out.printf("%.2f%s\n", r, "%");

Scanner scanner = new Scanner(System.in);
System.out.print("上次考核成绩: ");
int first = scanner.nextInt();
System.out.print("本次考核成绩: ");
int current = scanner.nextInt();
float r = (float) (current - first) / first * 100;
System.out.printf("%.2f%s\n", r, "%");


  • 1

Reply