import java.util.Scanner;
public class shujutongji {
public final static int INF=1000000000;
public static void main(String[] args) {
// TODO Auto-generated method stub
int x,n=0,min=INF,max=-INF,s=0;
Scanner scanner=new Scanner(System.in);
//次数的#号可以改为其他的标识符
while(!scanner.hasNext("#")) {
x=scanner.nextInt();
s+=x;
if(x<min)min=x;
if(x>max)max=x;
n++;
}
System.out.println(min);
System.out.println(max);
System.out.println((double)s/n);
}
}
while(scanf(“%d“,&n)==1) 在JAVA中实现类似功能
最新推荐文章于 2024-03-02 17:46:59 发布