import java.util.Scanner;
public class Temperature {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
double total = 0;
for (int i = 0; i < 5; i++)
{
System.out.println("Enter temperature: ");
double temperature = scanner.nextDouble();
total += temperature;
}
System.out.println("The total temperature = " + total);
System.out.println("The average temperature = " + total / 5);
}
}
Comments
Leave a comment