4,578,542 th visitor since 2017.2.1 ( Today : 142 )
Programming
No. 455
Name. swindler
Subject. 실수 소수점 출력 자리 지정
Main Cate. Java
Sub Cate.
Date. 2008-07-14 21:26
Hit. 3375 (211.36.27.8)
File.
public class Foo {
public static void main(String args[]) {

// 원주율을 소수점 15자리까지 출력
System.out.format("%.15f%n", Math.PI);
// 결과: 3.141592653589793


// 원주율을 소수점 3자리까지 출력
System.out.format("%.3f%n", Math.PI);
// 결과 (반올림되었음): 3.142

}
}

[바로가기 링크] : http://coolx.net/cboard/develop/455



Name
Password
Comment
Copyright © 1999-2017, swindler. All rights reserved. 367,611 visitor ( 1999.1.8-2004.5.26 ), 2,405,771 ( -2017.01.31)

  2HLAB   2HLAB_Blog   RedToolBox   Omil   Omil_Blog