Discuss / Java / Solution

Solution

Topic source

夜游蛇

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

import java.util.Scanner;

public class Solution1 {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);

        System.out.print("Please input last time score: ");

        int last = scanner.nextInt();

        System.out.print("Please input this time score: ");

        int now = scanner.nextInt();

        double out = (double)(now - last)/last;

        System.out.printf("小明提高的成绩百分比是 %.2f%%", 100*out);

    }

}


  • 1

Reply