import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); String s=sc.next(); Integer a=Integer.valueOf(s, 16); String b=s.toUpperCase(); String c=Integer.toString(a, 8); String news=""; if(b.length()<3){ for (int i = 1; i <=3-b.length(); i++) { news+="0"; } news+=b; b=news; } if(c.length()<4){ news=""; for (int i = 1; i <=4-c.length(); i++) { news+="0"; } news+=c; c=news; } System.out.println("Hex: 0x"+b); System.out.println("Decimal: "+a); System.out.println("Octal: "+c); } }
0.0分
1 人评分
弟弟的作业 (C++代码)浏览:1304 |
C语言训练-素数问题 (C语言代码)浏览:1660 |
C语言程序设计教程(第三版)课后习题5.4 (C语言代码)浏览:524 |
WU-字符串比较 (C++代码)浏览:756 |
2004年秋浙江省计算机等级考试二级C 编程题(1) (C语言代码)浏览:506 |
C语言程序设计教程(第三版)课后习题9.6 (C语言代码)浏览:585 |
C语言程序设计教程(第三版)课后习题9.10 (C语言代码)浏览:557 |
C语言程序设计教程(第三版)课后习题8.8 (C语言代码)浏览:1428 |
C语言程序设计教程(第三版)课后习题3.7 (C语言代码)浏览:262 |
1071题解浏览:493 |