ranchgirl
版主
发贴: 801
积分: 132
|
于 2005-07-08 21:25
整数部分: System.out.println((int)k); 小数部分:System.out.println(k-(int)k);
If you only want the digits of 小数部分, then String s = "" + (k-(int)k); System.out.println(s.substring(2));
BTW, please don't use k as double or float names.
i, j, k are used as int variable names by programmers since FORTRAN time, we should respect the tradition or history.
In FORTRAN, they are automatic as integers. FORTRAN is the first high level language in history (1950's) FORTRAN is still the most efficient high level language in scientific calculation.
FORTRAN is still used in NASA space shuttle programs. It is them who sent men on the moon!!!
gongshi edited on 2005-07-08 22:06
|