nner s = new Scanner(System.in); int[][] a = new int[3][3]; System.out.println(¡°ÇëÊäÈë9¸öÕûÊý£º¡±); for(int i=0; i<3; i++) { for(int j=0; j<3; j++) { a[i][j] = s.nextInt(); } } System.out.println(¡°ÊäÈëµÄ3 * 3 ¾ØÕóÊÇ:¡±); for(int i=0; i<3; i++) { for(int j=0; j<3; j++) { System.out.print(a[i][j] + ¡± ¡°); } System.out.println(); } int sum = 0; for(int i=0; i<3; i++) { for(int j=0; j<3; j++) { if(i == j) { sum += a[i][j]; } } } System.out.println(¡°¶Ô½ÇÏßÖ®ºÍÊÇ£º¡± + sum); }} ¡¾³ÌÐò30¡¿ ÌâÄ¿£ºÓÐÒ»¸öÒѾÅźÃÐòµÄÊý×é¡£ÏÖÊäÈëÒ»¸öÊý£¬ÒªÇó°´ÔÀ´µÄ¹æÂɽ«Ëü²åÈëÊý×éÖС£ //´Ë³ÌÐò²»ºÃ£¬Ã»ÓÐʹÓÃÕÛ°ë²éÕÒ²åÈë import java.util.*; public class lianxi30 { public static void main(String[] args) { int[] a = new int[]{1, 2, 6, 14, 25, 36, 37,55}; int[] b = new int[a.length+1]; intt1=0,t=0; int i =0; Scanner s= new Scanner(System.in); System.out.print(¡°ÇëÊäÈëÒ»¸öÕûÊý£º¡±); int num = s.nextInt(); if(num >= a[a.length-1]) { b[b.length-1] = num; for(i=0; i b[i] = a[i]; } } else { for(i=0; i if(num >= a[i]) { b[i] = a[i]; } else { b[i] = num; break; } } for(int j=i+1; j b[j] = a[j-1]; } } for (i = 0; i < b.length; i++) { System.out.print(b[i] + ¡± ¡°); }} } ¡¾³ÌÐò31¡¿ ÌâÄ¿£º½«Ò»¸öÊý×éÄæÐòÊä³ö¡£ import java.util.*; public class lianxi31 { public static void main(String[] args) { Scanner s = new Scanner(System.in); int a[] = new int[20]; System.out.println(¡°ÇëÊäÈë¶à¸öÕýÕûÊý£¨ÊäÈë-1±íʾ½áÊø£©£º¡±); int i=0,j; do{ a[i]=s.nextInt(); i++; }while (a[i-1]!=-1); System.out.println(¡°ÄãÊäÈëµÄÊý×éΪ£º¡±); for( j=0; j System.out.print(a[j]+¡± ¡°); } System.out.println(¡°\nÊý×éÄæÐòÊä³öΪ£º¡±); for( j=i-2; j>=0; j=j-1) { System.out.print(a[j]+¡± ¡°); } } } ¡¾³ÌÐò32¡¿ ÌâÄ¿£ºÈ¡Ò»¸öÕûÊýa´ÓÓҶ˿ªÊ¼µÄ4¡«7λ¡£ import java.util.*; public class lianxi32 { public static void main(String[] args) { Scanner s = new Scanner(System.in); System.out.print(¡°ÇëÊäÈëÒ»¸ö7λÒÔÉϵÄÕýÕûÊý£º¡±); long a = s.nextLong(); String ss = Long.toString(a); char[] ch = ss.toCharArray(); int j=ch.length; if (j<7){System.out.println(¡°ÊäÈë´íÎ󣡡±);} else { System.out.println(¡°½ØÈ¡´ÓÓҶ˿ªÊ¼µÄ4¡«7λÊÇ£º¡±+ch[j-7]+ch[j-6]+ch[j-5]+ch[j-4]); } } } ¡¾³ÌÐò33¡¿ ÌâÄ¿£º´òÓ¡³öÑî»ÔÈý½ÇÐΣ¨ÒªÇó´òÓ¡³ö10ÐÐÈçÏÂͼ£© 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 1 5 10 10 5 1 ¡¡¡¡ public class lianxi33 { public static void main(String[] args) { int[][] a = new int[10][10]; for(int i=0; i<10; i++) { a[i][i] = 1; a[i][0] = 1; } for(int i=2; i<10; i++) { for(int j=1; j a[i][j] = a[i-1][j-1] + a[i-1][j]; } } for(int i=0; i<10; i++) { for(int k=0; k<2*(10-i)-1; k++) { System.out.print(¡± ¡°); } for(int j=0; j<=i; j++) { System.out.print(a[i][j] + ¡° ¡°); } System.out.println(); } }} ¡¾³ÌÐò34¡¿ ÌâÄ¿£ºÊäÈë3¸öÊýa,b,c£¬°´´óС˳ÐòÊä³ö¡£ import java.util.Scanner; public class lianxi34 { public static void main(String[] args) { Scanner s = new Scanner(System.in); System.out.println(¡°ÇëÊäÈë3¸öÕûÊý£º¡±); int a = s.nextInt(); int b = s.nextInt(); int c = s.nextInt(); if(a < b) { int t = a; a = b; b = t; } if(a < c) { int t = a; a = c; c = t; } if(b < c) { int t = b; b = c; c = t; } System.out.println(¡°´Ó´óµ½Ð¡µÄ˳ÐòÊä³ö:¡±); System.out.println(a + ¡± ¡± + b + ¡± ¡± + c); }} ¡¾³ÌÐò35¡¿ ÌâÄ¿£ºÊäÈëÊý×飬×î´óµÄÓëµÚÒ»¸öÔªËؽ»»»£¬×îСµÄÓë×îºóÒ»¸öÔªËؽ»»»£¬Êä³öÊý×é¡£ import java.util.*; public class lianxi35 { public static void main(String[] args) { int N = 8; int[] a = new int [N]; Scanner s = new Scanner(System.in); int idx1 = 0, idx2 = 0; System.out.println(¡°ÇëÊäÈë8¸öÕûÊý£º¡±); for(int i=0; i a[i] = s.nextInt(); } System.out.println(¡°ÄãÊäÈëµÄÊý×éΪ£º¡±); for(int i=0; i System.out.print(a[i] + ¡± ¡°); } int max =a[0], min = a[0]; for(int i=0; i if(a[i] > max) { max = a[i]; idx1 = i; } if(a[i] < min) { min = a[i]; idx2 = i; } } if(idx1 != 0) { int temp = a[0]; a[0] = a[idx1]; a[idx1] = temp; } if(idx2 != N-1) { int temp = a[N-1]; a[N-1] = a[idx2]; a[idx2] = temp; } System.out.println(¡°\n½»»»ºóµÄÊý×éΪ£º¡±); for(int i=0; i System.out.print(a[i] + ¡± ¡°); } }} ¡¾³ÌÐò36¡¿ ÌâÄ¿£ºÓÐn¸öÕûÊý£¬Ê¹ÆäÇ°Ãæ¸÷Êý˳ÐòÏòºóÒÆm¸öλÖã¬×îºóm¸öÊý±ä³É×îÇ°ÃæµÄm¸öÊý import java.util.Scanner; public class lianxi36 { public static void main(String[] args) { int N =10; int[ |