题解 | #整数的十位#

整数的十位

https://www.nowcoder.com/practice/031db23916904f4fad72198fe491b47b

import java.util.Scanner;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        int n=in.nextInt();
        if(n>=10 && n<100){
            int c=n/10;
            System.out.print(c);
        }else{
            int c=(n/10)%10;
            System.out.print(c);
        }
    }
}

全部评论

相关推荐

一表renzha:你点进去没打招呼他也会有提示的,之前我点进美的,还没打招呼,他马上给我发了不太合适哦
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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