import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner myObj = new Scanner(System.in);
float arr[] = {0,1,2,3,4};
String txt[] = {"first", "second", "third", "fourth", "fifth"};
for (int i=0;i<arr.length; i++){
System.out.println("Enter the " + txt[i] + " number.");
float num1 = myObj.nextFloat();
arr[i] = num1;
}
for (int w = 0; w< arr.length; w++){
System.out.println("The " + txt[w] + " number is " + arr[w]);
arr[w] = Math.round(arr[w]);
}
System.out.println(" ");
for (int w = 0; w < arr.length; w++){
System.out.println("The " + txt[w] + " number is " + arr[w]);
}
System.out.println(" ");
float total = 0;
for (float w : arr){
total += w;
}
System.out.println("The sum of the numbers is " + total + " and the average is " + (total / 5));
}
}
I hope this helps!