1. Klik Start >> run (Logo windows + R)
2. Ketik cmd >> Ok, maka akan tampil kotak CPrompt
public class suhu {
public static void main(String[] args)
{
//deklarasi variabel
int c1, c2, c3, f1, f2, f3;
//proses perhitungan konversi
c1 = 34;
f1 = ((c1*9/5)+32) ;
c2 = 0;
f2 = ((c2*9/5)+32) ;
c3 = 24;
f3 = ((c3*9/5)+32) ;
//proses output
System.out.println("\t\t***KONVERSI SUHU DARI CELCIUS ke FAHRENHEIT***\n");
System.out.println("\t\t\t=*=*=*=*=*=*=*=*=*=*=*=*=*=*");
System.out.println("\t\t\tSuhu Awal dalam Celcius : "+c1+"\n");
System.out.println("\t\t\t34 Celcius is "+f1);
System.out.println("\t\t\t=*=*=*=*=*=*=*=*=*=*=*=*=*=*");
System.out.println("\t\t\tSuhu Awal dalam Celcius : "+c2+"\n");
System.out.println("\t\t\t0 Celcius is "+f2);
System.out.println("\t\t\t=*=*=*=*=*=*=*=*=*=*=*=*=*=*");
System.out.println("\t\t\tSuhu Awal dalam Celcius : "+c3+"\n");
System.out.println("\t\t\t24 Celcius is "+f3 );
System.out.println("\t\t\t=*=*=*=*=*=*=*=*=*=*=*=*=*=*");
}
}
Output :
0 komentar:
Post a Comment