有一个数组,将其最大的元素与第一个元素交换,最小的元素与最后一个元素交换,然后输出数组。 public class Example35 { public static void main(String[] args) { int[] a = { 5, 7, 6, 1, 9, 4, 2, 3, 8 } Read More
posted @ 2017-06-07 10:43 本宫在,尔等都是妃 Views(146) Comments(0) Diggs(0) Edit
输入3个数a,b,c,按大小顺序输出。 public class Example34 { public static void main(String[] args) { sort(5, 20, 15); } public static void sort(int a, int b, int c) Read More
posted @ 2017-06-07 10:42 本宫在,尔等都是妃 Views(159) Comments(0) Diggs(0) Edit
打印出杨辉三角形(要求打印出10行如下图)11 11 2 11 3 3 11 4 6 4 11 5 10 10 5 1 public class Example33 { public static void main(String[] args) { yanghui(10); } public st Read More
posted @ 2017-06-07 10:41 本宫在,尔等都是妃 Views(187) Comments(0) Diggs(0) Edit
取一个整数a从右端开始的4~7位。 public class Example32 { public static void main(String[] args) { cut(123456789); } public static void cut(long n) { String s = Long Read More
posted @ 2017-06-07 10:40 本宫在,尔等都是妃 Views(122) Comments(0) Diggs(0) Edit
将一个数组逆序输出。 public class Example31 { public static void main(String[] args) { int[] a = { 9, 4, 6, 8, 3, 21, 16, 12 }; covertArray(a); } public static Read More
posted @ 2017-06-07 10:39 本宫在,尔等都是妃 Views(215) Comments(0) Diggs(0) Edit