In: Computer Science
import java.util.*;
public class Demo {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int ar[] = new int[10];
for(int i=0;i<10;i++){
System.out.print("Enter score:");
ar[i]=sc.nextInt();
}
float sum=0;
int max=ar[0];
float avg;
for(int i=0;i<10;i++) {
sum=sum+ar[i];
if(max<ar[i]) max=ar[i];
}
avg=sum/10;
System.out.printf("Average: %.2f\n",avg);
System.out.println("Highest score: "+max);
int count=0;
for(int i=0;i<10;i++) {
if(ar[i]<avg)
{
count++;
}
}
System.out.println("Number of student scored below average: "+count);
double ar2[]= new double[10];
System.out.print("Score after curving: ");
double sqrtsum=0;
for(int i=0;i<10;i++) {
double num = Math.sqrt(ar[i]);
ar2[i]=num*10;
if(i==9)System.out.printf("%.2f",ar2[i]);
else System.out.printf("%.2f,",ar2[i]);
sqrtsum=sqrtsum+ar2[i];
}
double sqrtavg=sqrtsum/10;
System.out.printf("\nNew average: %.2f",sqrtavg);
}
}
i am sharing the code screenshot in ide for reference for indentation
OUTPUT: