Final answer:
This detailed answer provides a Java program that adds three numbers and finds their total and average. It also includes formatted output to display the numbers and their average in a specific format.
Step-by-step explanation:
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("Enter the first number: ");
int num1 = sc.nextInt();
System.out.print("Enter the second number: ");
int num2 = sc.nextInt();
System.out.print("Enter the third number: ");
int num3 = sc.nextInt();
int total = num1 + num2 + num3;
double average = total / 3.0;
System.out.println("First Number = " + num1);
System.out.println("Second Number = " + num2);
System.out.println("Third Number = " + num3);
System.out.println("Total = " + total);
System.out.println("Average = " + average);
}
}