algoritma procedure_suhu
deklarasi
pil : integer
c,k,r,f : real
deskripsi
procedure fahreinheit
read(c)
F ← (1.8*c)+32
write(f)
end;
procedure reamur
read(c)
r ← (0.8*c)
write(r)
end;
procedure kelvin
read(c)
k ← 273 + c
write(k)
end;
begin
read(pil)
case pil of
1:fahreinheit;
2:reamur;
3:kelvin;
else
write('pilihan tidak ada')
end;
end
program prosedur_suhu;
uses wincrt;
var
pil:integer;
c,f,r,k:real;
procedure fah(c,f:real);
begin
write(' masukan suhu dalam derajat celsius = ');readln(c);
f:=(1.8*c)+32;
writeln(' suhu dalam derajat fahreinheit = ',f:2:2);
end;
procedure re(c,r:real);
begin
write(' masukan suhu dalam derajat celsius = ');readln(c);
r:=0.8*c;
writeln(' suhu dalam derajat reamur = ',r:2:2);
end;
procedure kel(k,c:real);
begin
write(' masukan suhu dalam derajat celsius = ');readln(c);
k:=273+c;
writeln(' suhu dalam derajat kelvin = ',k:2:2);
end;
begin
writeln(' ______________MENU SUHU_____________');
WRITELN;
writeln(' 1. derajad fahreinheit');
writeln(' 2. derajad kelvin');
writeln(' 3. derajad reamur');
writeln;
write (' pilihan anda = ');readln(pil);
writeln;
case pil of
1:fah(c,f);
2:kel(k,c);
3:re(r,c);
else
write(' pilihan tidak ada');
end;
end.
Artikel Terkait:
0 komentar:
Posting Komentar