contoh program pascal dengan kondisi IF...THEN...ELSE
program Data_Nilai;
uses
crt;
var
nilai: integer;
begin
clrscr;
write('Masukkan nilai : '); readln(nilai);
if nilai >= 82 then
write ('Nilai A')
else if nilai >= 72 then
write ('Nilai B')
else if nilai >= 56 then
write ('Nilai C')
else if nilai >= 41 then
write ('Nilai D')
else if nilai <= 40 then
write ('Nilai E');
readln;
end.
program Data_Nilai;
uses
crt;
var
nilai: integer;
begin
clrscr;
write('Masukkan nilai : '); readln(nilai);
if nilai >= 82 then
write ('Nilai A')
else if nilai >= 72 then
write ('Nilai B')
else if nilai >= 56 then
write ('Nilai C')
else if nilai >= 41 then
write ('Nilai D')
else if nilai <= 40 then
write ('Nilai E');
readln;
end.
0 komentar :
Posting Komentar