Tugas 26
1. Telusuri algoritma dibawah ini:
ALGORITMA AllAboutboolean
KAMUS
x, y, z : boolean
a : integer
BEGIN
INPUT(a)
x <-- false
z <-- ((3 + (5 mod 3)) = 5)
y <-- (a <= 0)
IF ((x and y) or (not(y or z))) THEN
OUTPUT(“Telkom university is The Best”)
ELSE IF ((y and (not z)) or (x and y)) THEN
OUTPUT(“Telkom university is The Clean Campus”)
END IF
OUTPUT(“Telkom university is The Smart Campus”)
END
Jika pengguna memasukkan -1, maka OUTPUT algoritma tersebut adalah?TELKOM UNIVERSITY IS THE SMART CAMPUS
Dalam Bahasa Pascal
Uses crt;
Var
X:boolean;
Y:boolean;
z:boolean;
a:Integer;
BEGIN
CLRSCR;
WRITELN('Masukan Nilai A: ');
READLN(A);
x:= false;
Z:=((3+(5 mod 3 ) = 5)) ;
Y:=(a<=0);
If((x and y) or (not(y or z))) Then WRITELN('Telkom University is The Best')
Else If ((Y and (not z) or (x and y))) Then WRITELN('Telkom University is The Clean Campus');
WRITELN('Telkom University Is The Smart Campus');
READLN();
End.
Tidak ada komentar:
Posting Komentar