-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTemperatureChecker.java
More file actions
35 lines (30 loc) · 1 KB
/
TemperatureChecker.java
File metadata and controls
35 lines (30 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import java.util.Scanner;
public class TemperatureChecker {
public static void main(String[] args) {
/*Ask the user to enter temperature in Celsius and print:
Above 35 → "Very Hot"
25–35 → "Warm"
15–24 → "Normal"
5–14 → "Cold"
Below 5 → "Very Cold" */
Scanner sc = new Scanner(System.in);
System.out.println("Enter the Temperature in C°");
double temp = sc.nextDouble();
if(temp > 35){
System.out.println("Very Hot");
}
else if(temp >= 25){
System.out.println("Warm");
}
else if(temp >= 15){
System.out.println("Normal");
}
else if(temp >= 5){
System.out.println("Cold");
}
else{
System.out.println("Very Cold");
}
sc.close();
}
}