求绝对值_JAVA_杭电ACM2003

来源:互联网 发布:o2o源码 编辑:程序博客网 时间:2024/06/06 05:52
import java.io.BufferedInputStream;
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(new BufferedInputStream(System.in));
        while (sc.hasNext()) {
            double d=sc.nextDouble();
            System.out.printf("%.2f", Math.abs(d));
            System.out.println();
        }
    }

}


0 0
原创粉丝点击