资源预览内容
亲,该文档总共2页全部预览完了,如果喜欢就下载吧!
资源描述
importimport javax.swing.JOptionPane;publicpublic classclass Numberpublicpublic staticstatic voidvoid main(String args) intint number = 0,d5,d4,d3,d2,d1; String str = JOptionPane.showInputDialog(输入一个1至99999之间的数); number = Integer.parseInt(str);ifif(0number&number0)/判断number是5位数的条件 System. out.println(number + 是5位数);ifif(d5=d1&d4=d2) System.out.println(number + 是回文数);elseelse System.out.println(number + 不是回文数); elseelse ifif(d40)/判断number是4位数的条件 System. out.println(number + 是4位数);ifif(d4=d1&d2=d3)/判断number是回文数的条件代码 System. out.println(number + 是回文数); elseelse System. out.println(number +不是回文数); elseelse ifif(d30)/判断number是3位数的条件 System. out.println(number + 是3位数);ifif(d3=d1)/判断number是回文数的条件 System.out.println(number + 是回文数); elseelse System. out.println(number +不是回文数); elseelse ifif(d2 != 0) System. out.println(number + 是2位数);ifif(d1 = d2) System. out.println(number +是回文数); elseelse System. out.println(number +不是回文数); elseelse ifif(d1 = 0 ) System. out.println(number + 是1位数); System. out.println(number +是回文数); elseelse System.out.printf(n= %d不在1至99999之间,number);
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号