-
-
Notifications
You must be signed in to change notification settings - Fork 37
Expand file tree
/
Copy pathtempAir.java
More file actions
27 lines (22 loc) · 801 Bytes
/
tempAir.java
File metadata and controls
27 lines (22 loc) · 801 Bytes
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
import java.util.Scanner;
public class TempAir {
public static void main(String[] args){
/* contoh pemakaian IF tiga kasus : wujud air */
/*Kamus*/
int T;
/*Program*/
System.out.println("Contoh IF tiga kasus");
System.out.print("Temperatur (der. C) = ");
//scanner untuk masukan temperatur air
Scanner scanner = new Scanner(System.in);
T = scanner.nextInt(); //masukan temperatur air dengan tipe int
//proses pengecekan dengan if
if (T < 0){
System.out.println("Wujud air beku " + T);
} else if ((0 <= T) && (T <= 100)) {
System.out.println ("Wujud air cair " + T);
} else if (T > 100) {
System.out.println("Wujud air uap/gas " + T);
}
}
}