Discuss / Java / 尝试

尝试

Topic source

JLGG2016

#1 Created at ... [Delete] [Delete and Lock User]

import java.util.Scanner;

public class Main {

public static void main(String[] args) {

Scanner scanner = new Scanner(System.in);

System.out.print("Input your last score");

int prev = scanner.nextInt();

System.out.print("Input your present score");

int score = scanner.nextInt();

double percent = (double)(score-prev)/prev*100;

String level = percent >= 0 ? "提升" : "下降" ;

System.out.printf("成绩%s了%.1f%%", level, percent);

}

}


  • 1

Reply