Created
October 30, 2025 03:04
-
-
Save dikiwidia/4f3425d60a96aaf1dbcb9246ca16a2a1 to your computer and use it in GitHub Desktop.
Latihan Kelas Pemrograman Dasar
This file contains hidden or 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
| <?php | |
| $mahasiswa = [ | |
| ["nama" => "Andi", "nim" => 10002, "nilai" => 79], | |
| ["nama" => "Arfan", "nim" => 10003, "nilai" => 81], | |
| ["nama" => "Umam", "nim" => 10004, "nilai" => 60], | |
| ]; | |
| foreach ($mahasiswa as $mhs) { | |
| $hasil = ""; | |
| if ($mhs["nilai"] < 70) { | |
| $hasil = "cukup"; | |
| } elseif ($mhs["nilai"] >= 70 && $mhs["nilai"] < 80) { | |
| $hasil = "baik"; | |
| } else { | |
| $hasil = "sangat baik"; | |
| } | |
| echo $mhs["nama"] . " (" . $mhs["nim"] . ") lulus dengan nilai " . $mhs["nilai"] . " (" . $hasil . ")<br />"; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment