题解 | #浮点数的个位数字#
浮点数的个位数字
http://www.nowcoder.com/practice/ffa94d27c6534396aef38813535c279f
import java.util.Scanner; import java.lang.String; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); double num=sc.nextDouble(); System.out.println((int)(num%10)); /*String s=sc.nextLine();第一次思考,复杂了 int dian=s.indexOf("."); String c=s.substring(dian+1,s.length()); System.out.println(c.length());*/ } }