LISTING PROGRAM
Uses wincrt;
Var
pilihan, arus, resist, vsi, hasil :integer;
Begin
Writeln;
Writeln
(‘1. Vt’);
Writeln
(‘2. Em’);
Writeln;
Writeln;
Writeln (‘Menghitung Tegangan :’)
readln (pilihan);
if pilihan=1
then
begin
write (‘Nilai Arus :'); readln (arus);
write ('Nilai Hambatan :'); readln (resist);
write ('Tegangan Sikat :');readln (vsi);
hasil:=arus*hambatan+vsi*2;
writeln;
writeln ('Nilai Vt:',hasil);
end
else
if pilihan=2 then
begin
write (‘Nilai Arus :'); readln (arus);
write ('Nilai Hambatan :'); readln (resist);
write ('Tegangan Sikat :'); readln (vsi);
hasil:=arus*hambatan+vsi*2;
writeln;
writeln ('Nilai Em:',hasil);
end
begin
write (‘Nilai Arus :'); readln (arus);
write ('Nilai Hambatan :'); readln (resist);
write ('Tegangan Sikat :');readln (vsi);
hasil:=arus*hambatan+vsi*2;
writeln;
writeln ('Nilai Vt:',hasil);
end
else
if pilihan=2 then
begin
write (‘Nilai Arus :'); readln (arus);
write ('Nilai Hambatan :'); readln (resist);
write ('Tegangan Sikat :'); readln (vsi);
hasil:=arus*hambatan+vsi*2;
writeln;
writeln ('Nilai Em:',hasil);
end
end.
FLOWCHART