//纯手工打的,望采纳
import java.util.Scanner;
public class Demo {
public static void main(String[] args){
System.out.println("请输入十个整数,用英文逗号隔开");
Scanner sc = new Scanner(System.in);
String s = sc.next();
String[] sArray = s.split(",");
int[] iArray = new int[sArray.length];
int sum = 0;
int temp;
for(int i = 0;iiArray[i] = Integer.parseInt(sArray[i]);
}
//排序求和
for(int i = 0;isum += iArray[i];
for(int j = 0;j if(iArray[i]
}
temp = iArray[i];
iArray[j] = iArray[i];
iArray[i] = temp;
}
}
System.out.println("您输入的十个数为:"+s);
System.out.println("和为:"+sum);
System.out.println("最大值为:"+iArray[0]);
}
}
import java.util.Arrays;
import java.util.Scanner;
public class ScannerTest {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int[] intArr = new int[10];
for(int i=0;i<10;i++) {
System.out.println("请输入第"+(i+1)+"个数字");
intArr[i] = sc.nextInt();
}
Arrays.sort(intArr);
System.out.println("最大值:"+intArr[9]);
int temp=0;
for(int arr:intArr) {
temp += arr;
}
System.out.println("数组和:"+temp);
}
}
Scanner sc=new Scanner(System.in);
int[] a=new int[10];
for(int i=0;i<10;i++){
int t=sc.nextInt();
a[i]=t;
}
sc.close();
int max=a[0];
int min=a[0];
for(int i=1;i<10;i++){
if(max max=a[i];
}
if(min>a[i]){
min=a[i];
}
}