import java.util.Scanner; public class Prog15{ public static void main(String[] args){ Scanner scan = new Scanner(System.in).useDelimiter("\\D"); System.out.print("请输入三个数:"); int x = scan.nextInt(); int y = scan.nextInt(); int z = scan.nextInt(); scan.close(); System.out.println("排序结果:"+sort(x,y,z)); } //比较两个数的大小 private static String sort(int x,int y,int z){ String s = null; if(x>y){ int t = x; x = y; y = t; } if(x>z){ int t = x; x = z; z = t; } if(y>z){ int t = z; z = y; y = t; } s = x+" "+y+" "+z; return s; } } |
public class Prog16{ public static void main(String[] args){ for(int i=1;i<10;i++){ for(int j=1;j<i+1;j++) System.out.print(j+"*"+i+"="+(j*i)+" "); System.out.println(); } } } |
public class Prog17{ public static void main(String[] args){ int m = 1; for(int i=10;i>0;i--) m = 2*m + 2; System.out.println("小猴子共摘了"+m+"桃子"); } } |
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) | 黑马程序员IT技术论坛 X3.2 |