File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments