摘要:
例5.6 用函数处理例5.5 public class Demo5_6 { public static void main(String[] args) { int row=0, colum=0, max; int[][] a = new int[][]{{5,12,23,56}, {19,28,3 阅读全文
摘要:
例5.1 数组元素的引用 public class Demo5_1 { public static void main(String[] args) { int[] a = new int[10]; for (int i = 0; i <= 9; i++) { a[i] = i; } for (in 阅读全文
摘要:
例4.10 有5个人坐在一起,问第5个人多少岁?他说比第4个人大两岁。问第4个人岁数,他说比第3个人大两岁。问第3个人,又说比第2个人大两岁。问第2个人,说比第1个人大两岁。最后问第1个人,他说是10岁。请问第5个人多大? public class Demo4_10 { public static 阅读全文
摘要:
例4.6 编写一个程序,用来求两个整数或3个整数中的最大数。如果输入两个整数,程序就输出这两个整数中的最大数,如果输入3个整数,程序就输出这3个整数中的最大数。 public class Demo4_6 { public static void main(String[] args) { int a 阅读全文
摘要:
例3.11 用do-while求1+2+3+...+100的值 public class Demo3_11 { public static void main(String[] args) { int i = 1; int sum = 0; do{ sum += i; i++; } while (i 阅读全文