CONTOH PROGRAM INPUT BIODATA,SEGITIGA,DAN MEMILIH MENU MAKANAN PADA PROLOG.
CODINGAN:
1.
menu:-nl,nl,
write('MENU'),nl,
write('1.BIODATA'),nl,
write('2.LUAS SEGITIGA'),nl,
write('3.EXIT'),nl,
write('Masukkan pilihan anda : '),read(PIL),nl,
(PIL=1,nl,
write('BIODATA'),nl,
write('MASUKKAN NAMA : '),read(A),nl,
write('MASUKKAN NPM: '),read(B),nl,
write('MASUKKAN KELAS : '),read(C),nl,
write('-----'),nl,
write('NAMA : '),write(A),nl,
write('NPM : '),write(B),nl,
write('KELAS : '),write(C),nl,
menu;
PIL=2,nl,
write('---luas segitiga---'),nl,
write('masukan alas : '),read(D),nl,
write('masukan tinggi : '),read(E),nl,
L is (0.5*D*E),
write('luas segitiga = '),write(L),nl,
menu;
PIL=3,nl,
write('Terimakasih'),nl).
OUTPUT:
2.
menu:-nl,
write(' SELAMAT DATANG! '),nl,
write('****MENU RESTORAN ABANG****'),nl,
write('1 BAKSO '),nl,
write('2 MIE AYAM '),nl,
write('3 SATE PADANG '),nl,
write('4 SATE KAMBING '),nl,
write('5 EXIT'),nl,
write('masukan pilihan :'),read(PIL),nl,
(PIL=1,nl,
write('BAKSO'),nl,
write('JUMLAH : '),read(O),nl,
BO is (O*10000),
write('TOTAL BAYAR: '),write(BO),nl,
menu;
PIL=2,nl,
write('MIE AYAM'),nl,
write('JUMLAH : '),read(A),nl,
MA is (A*15000),
write('TOTAL BAYAR: '),write(MA),nl,
menu;
PIL=3,nl,
write('SATE PADANG'),nl,
write('JUMLAH : '),read(P),nl,
SP is (P*5000),
write('total: '),write(SP),nl,
menu;
PIL=4,nl,
write('SATE KAMBING'),nl,
write('JUMLAH : '),read(K),nl,
SK is (K*5000),
write('TOTAL BAYAR: '),write(SK),nl,
menu;
PIL=5,nl,
write('EXIT'),nl).
jangan lupa klo mau run program harus diakhiri dengan titik (.)
Komentar
Posting Komentar