package set; import java.util.Scanner; public class SKSK { public static void main(String[] args) { int[] arr=new int[] {10,20,30,40,50}; for(int s=0;s<arr.length;s++) { System.out.println(arr[s]+""); } } }
public class SKSK { public static void main(String[] args) { int[] arr = new int[5]; arr[0] = 10; arr[1] = 20; arr[2] = 30; arr[3] = 40; arr[4] = 50; for (int a = 0; a < 5; a++) { System.out.println(arr[a]); } } }
public class SKSK { public static void main(String[] args) { int[]s= {23,45,22,33,56}; int a=0; for(int b=0;b<s.length;b++) { a=a+s[b]; } System.out.println(a); double c =a/s.length; System.out.println(c); } }
package set; public class SKSK { public static void main(String[] args) { int[] a = {18,25,7,36,13,2,89,63}; int[] b = new int[a.length]; System.arraycopy(a, 0, b, 0, a.length); for(int i=0; i<b.length-1; i++) { if(b[i]>b[i+1]) { int temp = b[i]; b[i] = b[i+1]; b[i+1] = temp; } } for(int e : b) { System.out.print(e+" "); } System.out.println(""); System.out.println("这个数组最大的数是:"+ b[b.length-1]); int c = 0; for(int i=0; i<a.length; i++) { if(a[i]==b[b.length-1]) { c=i; } } System.out.println(c); }}
package set; public class SKSK { public static void main(String[] args) { int [] c = {33,44,22,45,66,77}; for (int i = 0; i < c.length / 2; i++) { int b = c[i]; c[i] = c[c.length - 1 - i]; c[c.length - 1 - i] =b; } for (int i = 0; i < c.length; i++) { System.out.print(c[i] + " "); } } }