题解 | #计算整数位数#

import java.util.Scanner;
//这道题就没啥难度了吧...试一下富文本编辑器哈哈哈哈哈哈
public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int num = scan.nextInt();
        scan.close();

        //write code here......
        if(num <= 0){
            System.out.print(num);
        }
        else{
            int pnum = 0;
            while(num > 0){
                num /= 10;
                pnum ++;
            }
            System.out.print(pnum);
        }

    }
}
全部评论

相关推荐

09-29 00:03
门头沟学院 Java
点赞 评论 收藏
分享
karis_aqa:和hr没关系,都是打工的
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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