WAP to obtain temperature of all the seven days(mon,tues, wed....) and display the average temperature
Answers
Answer:
import java.util.*;
public class Temp {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int mon, tue, wed, thu, fri, sat, sun;
System.out.print("Enter Temprature of monday in celcius: ");
mon = sc.nextInt();
System.out.print("Enter Temprature of tuesday in celcius: ");
tue = sc.nextInt();
System.out.print("Enter Temprature of wednesday in celcius: ");
wed = sc.nextInt();
System.out.print("Enter Temprature of thursday in celcius: ");
thu = sc.nextInt();
System.out.print("Enter Temprature of friday in celcius: ");
fri = sc.nextInt();
System.out.print("Enter Temprature of saturday in celcius: ");
sat = sc.nextInt();
System.out.print("Enter Temprature of Sunday in celcius: ");
sun = sc.nextInt();
System.out.println("Average: " + ((mon + tue + wed + thu + fri + sat + sun) / 7) + " degree celcius.");
}
}