Program Pascal dg Struktur Perulangan Ditentukan User
Program Pascal dg Struktur Perulangan Ditentukan User
Contohnya :
Program UlangVolumeBalok;
Uses crt;
Var p,l,t,V:integer;
pilihan:char;
Begin
Clrscr;
Repeat
Write('Panjang=');
Readln(p);
Write('Lebar=');
Readln(l);
Write('Tinggi=');
Readln(t);
Write('Volume=');
V:= p*l*t;
writeln (v);
Writeln ('ingin menghitung lagi y/n');
Readln (pilihan);
until (pilihan='n');
End.
Contohnya :
Program UlangVolumeBalok;
Uses crt;
Var p,l,t,V:integer;
pilihan:char;
Begin
Clrscr;
Repeat
Write('Panjang=');
Readln(p);
Write('Lebar=');
Readln(l);
Write('Tinggi=');
Readln(t);
Write('Volume=');
V:= p*l*t;
writeln (v);
Writeln ('ingin menghitung lagi y/n');
Readln (pilihan);
until (pilihan='n');
End.
No comments