public class Average
{
public static void main(String[] args)
{
int chj[]={1,2,3,4,5,6};
int sum=0;
double average;
for(int i=0;i
sum+=chj[i];
}
average=(double)sum/chj.length;
System.out.println("该数组的平均值为:"+average);
}
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)