Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - Java defines a 1 plastic array with the length of 10. The values stored in the array are 1, 2, 3, 4, 5, 6, 7, 8, 9, 10. Find the sum and average of arrays.
Java defines a 1 plastic array with the length of 10. The values stored in the array are 1, 2, 3, 4, 5, 6, 7, 8, 9, 10. Find the sum and average of arrays.
Common class test {

Public static void main(String args[])

{

int arr[] = { 1,2,3,4,5,6,7,8,9, 10 };

int sum = 0;

int avg=0

for(int I = 0; I< 10; i++){

sum+= I;

}

avg = sum/ 10;

system . out . println(" sum = "+sum ");

system . out . println(" avg = "+avg);

}