大水题Q2003

来源:互联网 发布:怎么使用百度的数据库 编辑:程序博客网 时间:2024/04/24 16:55

Problem Description
求实数的绝对值。
 

Input
输入数据有多组,每组占一行,每行包含一个实数。
 

Output
对于每组输入数据,输出它的绝对值,要求每组数据输出一行,结果保留两位小数。
 

Sample Input
123-234.00
 

Sample Output
123.00234.00
import java.text.DecimalFormat;import java.util.Scanner;public class Q2003 {public static void main(String[] args){Scanner s = new Scanner(System.in);while(s.hasNext()){double d = Math.abs(s.nextDouble());DecimalFormat df = new DecimalFormat(".00");System.out.println(df.format(d));}s.close();}}

没什么好说的 又一只大水题