Skip to content

Commit 024ed93

Browse files
Add files via upload
1 parent bcf0f2f commit 024ed93

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

TempAir.java

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import java.util.Scanner;
2+
3+
public class TempAir {
4+
public static void main(String[] args){
5+
/* contoh pemakaian IF tiga kasus : wujud air */
6+
7+
/*Kamus*/
8+
int T;
9+
10+
/*Program*/
11+
System.out.println("Contoh IF tiga kasus");
12+
System.out.print("Temperatur (der. C) = ");
13+
14+
//scanner untuk masukan temperatur air
15+
Scanner scanner = new Scanner(System.in);
16+
T = scanner.nextInt(); //masukan temperatur air dengan tipe int
17+
18+
//proses pengecekan dengan if
19+
if (T < 0){
20+
System.out.println("Wujud air beku " + T);
21+
}else if ((0 <= T) && (T <= 100))
22+
{
23+
System.out.println ("Wujud air cair " + T);
24+
}
25+
else if (T > 100)
26+
{
27+
System.out.println("Wujud air uap/gas " + T);
28+
}
29+
}
30+
}

0 commit comments

Comments
 (0)