题解 | #浮点数的个位数字#

浮点数的个位数字

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());*/
    }
}

全部评论

相关推荐

投了十几个无人回应
花环鞣: 佬,我隔壁的
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务