题解 | #小乐乐与进制转换#

小乐乐与进制转换

https://www.nowcoder.com/practice/242eafef2a704c0ca130d563b7b3ee2d

import java.util.Scanner;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static void main(String[] args) {
       Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        //Integer.toString(str1,str2) str1 表示要转换成字符串的数字
        //str2 表示要转换成的进制
        String ans = Integer.toString(n,6);
        System.out.print(ans);
    }
}

全部评论

相关推荐

周述安:这都能聊这么多。别人要是骂我,我就会说你怎么骂人?他要是继续骂我,我就把评论删了。
点赞 评论 收藏
分享
09-29 13:47
门头沟学院 Java
#腾讯 #阿里 #字节
投递小米集团等公司10个岗位 >
点赞 评论 收藏
分享
点赞 收藏 评论
分享
牛客网
牛客企业服务