Ini adalah Contoh percabangan dengan penambahan syarat.
Seseorang dinyatakan lulus jika:
- Nilai bagus dan Tinggi Badan terpenuhi,
- Nilai bagus dan Tinggi Badan gagal,
Seseorang dinyatakan TDK lulus jika:
- Nilai gagal dan Tinggi Badan terpenuhi,
- Nilai gagal dan Tinggi Badan gagal,
/*programs lulus
* UTS:30
* UAS:30
* TUGAS:20
* PRESENSI:20
* Rerata>=80 dan Tinggi Badan >= 160
*
*/
mulai:-
nl,
write("*************************************"),nl,
write("Program Perhitungan Grade"),nl,
write("*************************************"),nl,
write("Input UTS Kamu: "),read(UTS),
write("Input UAS Kamu: "),read(UAS),
write("Input TUGAS Kamu: "),read(TuG),
write("Input Presensi Kamu: "),read(Pre),
write("Input Tinggi Badan: "),read(TB),
Rerata is ((UTS*30) + (UAS*30) + (TuG*20) + (Pre*20))/100,
write("Nilai UTS Kamu: "),write(UTS),nl,
write("Nilai UAS Kamu: "),write(UAS),nl,
write("Nilai TUGAS Kamu: "),write(TuG),nl,
write("Nilai Presensi Kamu: "),write(Pre),nl,
write("*************************************"),nl,
write("Nilai Rerata Kamu: "),write(Rerata),nl,
write("Input Tinggi Badan: "),write(TB),nl,
(
( Rerata >=80,TB>=160), write("LULUS");
( Rerata <80,TB<160), write("TIDAK LULUS");
( Rerata >=80,TB<160), write("LULUS");
( Rerata <80,TB>=160), write("TIDAK LULUS")
).
No comments:
Post a Comment
Note: only a member of this blog may post a comment.