如果用Java写应该怎么写

B2016 浮点数向零舍入

lonely_wolf0017 @ 2024-11-07 17:48:57


by Estelle_N @ 2024-11-07 18:12:43

@lonely_wolf0017

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        long a;
        double b = scan.nextDouble();
        a = (long) b;
        System.out.printf("%d\n", a);
    }
}

by lonely_wolf0017 @ 2024-11-07 21:14:33

@Estelle_N ok,谢谢


|