Wednesday, January 16, 2008

Find the Mean of the Array

import java.io.*;
class Mean
{
public static void main(String args[])throws IOException
{
int x[]=new int[10];
int a=0,i=0,j=0;
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.println(" Enter 10 Values");
int sum=0,mean=0;
for(i=0;i<10;i++)
{
x[i]=Integer.parseInt(br.readLine());
sum=sum+x[i];
}
mean = sum/10;
System.out.println(" Mean = "+mean);
}
}

No comments: