Skip to content

Commit 49b3216

Browse files
marsyadani0427-sysM. Arsyadani
andauthored
250441100054_M_ARSYADANI (#113)
* 25044110054_M_ARSYADANI_Modul1_AsprakKakDHANI * 250441100054_M_ARSYADANI_Modul2_AsprakKakDhani * 250441100054_M_ARSYADANI_Modul3_KakDhani * 250441100054_M_ARSYADANI_UTS_KakDhani * 250441100054_M_ARSYADANI_Modul4_MasDhani * 250441100054_M_ARSYADANI_Modul5_MasDhani --------- Co-authored-by: M. Arsyadani <arsyadani25044110054@example.com>
1 parent 0cae889 commit 49b3216

File tree

12 files changed

+297
-0
lines changed

12 files changed

+297
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#diketahui jumlah barang
2+
jumlah_buku = 3
3+
jumlah_pulpen = 2
4+
5+
#nilai satuan
6+
harga_buku = 5000
7+
harga_pulpen = 4500
8+
9+
#menghitung harga barang
10+
total_harga_buku = (jumlah_buku * harga_buku)
11+
total_harga_pulpen= (jumlah_pulpen * harga_pulpen)
12+
13+
print("Total biaya Buku: Rp", total_harga_buku)
14+
print("Total biaya pulpen: Rp", total_harga_pulpen)
15+
16+
#menghitung harga sebelum dikenakan pajak
17+
harga_asli = total_harga_buku + total_harga_pulpen
18+
print("harga asli: Rp",harga_asli)
19+
20+
#pajak 10%
21+
pajak = harga_asli * 0.10
22+
print("total setelah kena pajakk:",pajak)
23+
24+
#menghitung total biaya setelah dikenakan pajak
25+
total_bayar = pajak + harga_asli
26+
print("Total harga yang harus dibayar: Rp",total_bayar)
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Program untuk menghitung volume dan luas permukaan balok
2+
# Input: panjang, lebar, tinggi dalam cm
3+
panjang = int(input("Diketahui panjang : "))
4+
lebar = int(input("Diketahui lebar :"))
5+
tinggi = int(input("Diketahui tinggi :"))
6+
7+
# Rumus volume balok
8+
volume = panjang * lebar * tinggi
9+
print("Volume balok: ",volume,"cm³")
10+
11+
# Rumus luas permukaan balok
12+
luas_permukaan = 2 * (panjang * lebar + panjang * tinggi + lebar * tinggi)
13+
print(f"Luas permukaan balok: ",luas_permukaan,"cm²")
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Program untuk menghitung jumlah kombinasi memilih 3 bola dari 14 bola (8 merah + 6 biru).
2+
# Kombinasi adalah cara memilih sejumlah item tanpa memperhatikan urutan.
3+
# Rumus kombinasi: C(n, k) = n! / (k! * (n - k)!)
4+
# Di sini, n = 14 (total bola), k = 3 (bola yang diambil sekaligus).
5+
# Mengapa menggunakan kombinasi? Karena urutan pengambilan bola tidak penting,
6+
# dan bola dianggap berbeda satu sama lain meskipun ada warna yang sama.
7+
# Hasil perhitungan: C(14, 3) = 14! / (3! * 11!) = (14 * 13 * 12) / (3 * 2 * 1) = 364
8+
9+
# Jumlah bola total
10+
total_bola = 8 + 6 # 8 bola merah + 6 bola biru
11+
bola_diambil = 3
12+
13+
hasil = (total_bola * (total_bola - 1) * (total_bola - 2)) // (bola_diambil * (bola_diambil - 1) * (bola_diambil - 2))
14+
15+
print(f"Jumlah kombinasi bola yang dapat diambil:",hasil)
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
jam_parkir = int(input("Masukkan lama parkir (jam): "))
2+
#tambahin seleksian jam
3+
if jam_parkir == 0:
4+
print("Tidak memarkirkan mobil")
5+
else:
6+
status_vip = input("Apakah Anda member VIP? (ya/tidak): ")
7+
8+
if status_vip == "ya":
9+
biaya = 0
10+
else:
11+
if jam_parkir <= 2:
12+
biaya = 5000
13+
elif jam_parkir <= 24:
14+
biaya = 5000 + (jam_parkir - 2) * 3000
15+
if biaya > 20000:
16+
biaya = 20000
17+
18+
else:
19+
hari_penuh = jam_parkir // 24
20+
sisa_jam = jam_parkir % 24
21+
biaya = hari_penuh * 20000
22+
if sisa_jam > 0:
23+
if sisa_jam <= 2:
24+
biaya += 5000
25+
else:
26+
biaya += 5000 + (sisa_jam - 2) * 3000
27+
if biaya > (hari_penuh + 1) * 20000:
28+
biaya = (hari_penuh + 1) * 20000
29+
print("Total biaya parkir: Rp", biaya)
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
<?xml version="1.0"?>
2+
<flowgorithm fileversion="4.2">
3+
<attributes>
4+
<attribute name="name" value="Soal1Praktikum"/>
5+
<attribute name="authors" value="iamkr"/>
6+
<attribute name="about" value=""/>
7+
<attribute name="saved" value="2025-10-09 09:04:38 PM"/>
8+
<attribute name="created" value="aWFta3I7SzsyMDI1LTEwLTA4OzAxOjMyOjAwIEFNOzE4NjA="/>
9+
<attribute name="edited" value="aWFta3I7SzsyMDI1LTEwLTA5OzA5OjA0OjM4IFBNOzI7MjAwMw=="/>
10+
</attributes>
11+
<function name="Main" type="None" variable="">
12+
<parameters/>
13+
<body>
14+
<declare name="nilai, nk" type="Integer" array="False" size=""/>
15+
<output expression="&quot;Masukkan Nilai&quot;" newline="True"/>
16+
<input variable="nilai"/>
17+
<if expression="nilai &gt;= 100 or nilai &lt;= 0">
18+
<then>
19+
<output expression="&quot;Nilai tidak valid&quot;" newline="True"/>
20+
</then>
21+
<else>
22+
<if expression="nilai&gt;=85">
23+
<then>
24+
<output expression="&quot;Masukkan Nilai kehadiran&quot;" newline="True"/>
25+
<input variable="nk"/>
26+
<output expression="&quot;A&quot;" newline="True"/>
27+
<if expression="nk &gt;=85 and nk &gt;=90">
28+
<then>
29+
<output expression="&quot;Lulus dengan pujian&quot;" newline="True"/>
30+
</then>
31+
<else>
32+
<output expression="&quot;Lulus biasa&quot;" newline="True"/>
33+
</else>
34+
</if>
35+
</then>
36+
<else>
37+
<if expression="nilai&gt;=70 and nilai &lt;84">
38+
<then>
39+
<output expression="&quot;B&quot;" newline="True"/>
40+
</then>
41+
<else>
42+
<if expression="nilai &gt;=60 and nilai &lt;69">
43+
<then>
44+
<output expression="&quot;C&quot;" newline="True"/>
45+
</then>
46+
<else>
47+
<if expression="nilai &gt;=50 and nilai &lt;59">
48+
<then>
49+
<output expression="&quot;D&quot;" newline="True"/>
50+
</then>
51+
<else>
52+
<output expression="&quot;E&quot;" newline="True"/>
53+
</else>
54+
</if>
55+
</else>
56+
</if>
57+
</else>
58+
</if>
59+
</else>
60+
</if>
61+
</else>
62+
</if>
63+
</body>
64+
</function>
65+
</flowgorithm>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
harga_normal = 50000
2+
3+
usia = int(input("Masukkan usia: "))
4+
if usia <= 0 or usia >= 100:
5+
print("Usia tidak valid")
6+
else:
7+
if usia < 15:
8+
status_pelajar = "tidak"
9+
else:
10+
status_pelajar = input("Apakah anda pelajar SMA dengan kartu pelajar? (ya/tidak): ")
11+
hari = input("Masukkan hari: ")
12+
diskon = 0
13+
14+
if usia < 12:
15+
diskon = 50
16+
if status_pelajar == "ya":
17+
if 30 > diskon:
18+
diskon = 30
19+
if hari == "selasa":
20+
if 20 > diskon:
21+
diskon = 20
22+
23+
bayar = harga_normal - (harga_normal * diskon // 100)
24+
25+
print("Harga tiket yang harus dibayar: Rp", bayar)
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
jumlah_baris= int(input("Masukkan jumlah baris lampu: "))
2+
3+
for x in range(1, jumlah_baris + 1):
4+
jumlah_lampu= int(input(f"Masukkan jumlah lampu di baris {x}: "))
5+
6+
for y in range(1, jumlah_lampu+ 1):
7+
if y % 3 == 0:
8+
print(f"Lampu ke-{y} pada baris {x} rusak.")
9+
else:
10+
print(f"Lampu ke-{y} pada baris {x} menyala.")
11+
12+
if x == jumlah_baris:
13+
print("Periksa sambungan daya utama.")
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
total_gaji = 0
2+
total_lembur = 0
3+
total_bonus = 0
4+
bonus_lembur = 0
5+
6+
for hari in range(1, 8):
7+
print("Hari ke-", hari)
8+
9+
jam_lembur = int(input("Masukkan jumlah jam lembur: "))
10+
shift_malam = input("Apakah shift malam? (y/n): ")
11+
12+
gaji_pokok = 100000
13+
tambahan_lembur = 0
14+
bonus_shift = 0
15+
16+
if jam_lembur == 0:
17+
tambahan_lembur = 0
18+
elif 1 <= jam_lembur <= 5:
19+
tambahan_lembur = jam_lembur * 25000
20+
elif jam_lembur == 6:
21+
tambahan_lembur = 200000
22+
elif jam_lembur == 7:
23+
tambahan_lembur = 250000
24+
elif jam_lembur == 8:
25+
tambahan_lembur = 300000
26+
elif jam_lembur > 8:
27+
print("Lembur melebihi batas, tidak dihitung.")
28+
tambahan_lembur = 300000
29+
30+
if shift_malam == "y":
31+
bonus_shift = 50000
32+
33+
total_gaji += gaji_pokok + tambahan_lembur + bonus_shift
34+
total_lembur += jam_lembur
35+
total_bonus += bonus_shift
36+
bonus_lembur += tambahan_lembur
37+
gaji_pokok = gaji_pokok * 7
38+
39+
print("=== Rekap Gaji Mingguan ===")
40+
print("Total jam lembur:", total_lembur, "jam")
41+
print("Total Bonus Lembur", bonus_lembur)
42+
print("Total bonus shift malam: Rp", total_bonus)
43+
print("Total Gaji Pokok", gaji_pokok)
44+
print("Total gaji seminggu: Rp", total_gaji)
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
n = int(input("Masukkan n: "))
2+
3+
for i in range(1, n+1):
4+
for j in range(1, i+1):
5+
print(j, end=' ')
6+
7+
for k in range(2 * (n - i)):
8+
print(' ', end=' ')
9+
10+
for j in range(i, 0, -1):
11+
print(j, end=' ')
12+
13+
print()
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
def factorial(n):
2+
if n == 0:
3+
return 1
4+
else:
5+
return n * factorial(n - 1)
6+
7+
n = int(input("Masukkan Bilangan bulat non-negatif n: "))
8+
if n < 0:
9+
print("Error:n harus bilangan bulat non-negatif.")
10+
else:
11+
hasil = factorial(n)
12+
print(f"Faktorial dari {n} adalah {hasil}")
13+

0 commit comments

Comments
 (0)