Contoh Program Pascal IF
Contoh Program Pascal IF
uses wincrt;
var a,b : integer;
begin
write('masukan a :');readln(a);
write('masukan b :');readln(b);
if (a<b) then
writeln(a, 'lebih kecil dari' ,b);
end.
==========================================
program if_ganda
uses wincrt;
var c,d:integer;
begin
write('masukan c:');readln(c);
write('masukan d:');readln(d);
if (c>d) then
begin
write(c,'lebih besar dari',d);
end
else
begin
write(c,' lebih kecil dari',d);
end
end.
========================================
program if_bersarang
uses wincrt;
var nama :string;
status,ja:integer;
T,ti,ta,gapok,gaber:real;
begin
clrscr;
write('masukan nama pegawai :');readln(nama);
write('masukan gaji pokok :');readln(gapok);
write('masukan status :');readln(status);
if status= 1 then
begin
write('masukan jumlah anak :');readln(ja);
ti:=0.1*gapok;
ta:=0.05*ja*gapok;
end
else if status = 2 then
begin
t:=0;
end
else if status =3 then
begin
write('masukan jumlah anak :');readln(ja);
ti:=0;
ta:=0.05*ja*gapok;
T:=ti+ta;
end;
gaber:=gapok+t;
write('nama : ',nama,'==========>>Gaji Bersih Anda: ',gaber:10:2);
;
end.
0 komentar:
Post a Comment