This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Konversi ke kelvin. | |
kelvin = celcius + 273 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Konversi ke Reamur. | |
reamur = celcius * 4 / 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Konversi ke Fahrenheit. | |
fahrenheit = celcius * 9 / 5 + 32 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Print hasil. | |
print("Kelvin: " + str(kelvin)) | |
print("Reamur: " + str(reamur)) | |
print("Fahrenheit: " + str(fahrenheit)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Suhu celcius: 1023 | |
Kelvin: 1296.0 | |
Reamur: 818.4 | |
Fahrenheit: 1873.4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Deklarasi variable. | |
int a = 1; | |
int b = 2; | |
// Tes. | |
System.out.println("a == b bernilai " + (a == b)); | |
System.out.println("a != b bernilai " + (a != b)); | |
System.out.println("a > b bernilai " + (a > b)); | |
System.out.println("a < b bernilai " + (a < b)); | |
System.out.println("a >= b bernilai " + (a >= b)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a == b bernilai false | |
a != b bernilai true | |
a > b bernilai false | |
a < b bernilai true | |
a >= b bernilai false | |
a <= b bernilai true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Dapatkan nilai tinggi badan. | |
tinggi_badan = int(input('Tinggi badan: ')) | |
# Cek nilai tinggi badan. | |
if tinggi_badan < 140: | |
print('Maaf, anda tidak bisa menaiki wahana roller coaster') | |
else: | |
print('Selamat menikmati wahana roller coaster!') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Dapatkan nilai tinggi badan. | |
tinggi_badan = int(input('Tinggi badan: ')) | |
# Dapatkan nilai umur. | |
umur = int(input('Umur: ')) | |
# Cek. | |
if tinggi_badan >= 140 and umur >= 15: | |
print('Selamat menikmati wahana roller coaster!') | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Dapatkan jenis kelamin. | |
jenis_kelamin = input('Jenis kelamin (L/P): ') | |
# Dapatkan umur. | |
umur = input('Umur: ') | |
# Cek. | |
if umur < 10 or jenis_kelamin == 'P': | |
print('Anda bisa naik') | |