Program Konversi Suhu Bag.2






Assalamu’alaikum para blogger....................
Sama seperti postingan sebelumnya, kali ini kita akan belajar membuat program
konversi suhu. Kalau pada bagian pertama itu suhu celcius dan farenhit, kali ni suhu Reamur dan kelvin.
Ok! Siapin pisang goreng dan ini dia codingnya;
Untuk suhu reamur;
uses crt;
var
c,f,r,k: real;
pil:byte;
begin
clrscr;
 writeln('   Menu konver Suhu Reamur');
 writeln('==============================');
 writeln('1.Reamur Ke Farenhit');
 writeln('2.Reamur ke Celcius');
 writeln('3.Reamur ke Kelvin');
 writeln('===============================');

 write('Pilihan :');
 readln(pil);
 if pil=1 then
 begin
   clrscr;
   writeln( 'Konver Reamur ke Farenhit');
   writeln('============================');
   write('Suhu Reamur:  ');readln(r);

   f:=(9/4) * r + 32  ;
   writeln('Suhu Farenhit:  ',f:2:0);
 End
  else if pil=2 then
 begin
 clrscr;
  writeln( '  Konver Reamur ke Celcius');
   writeln('============================');
   write('Suhu Reamur:  ');
   readln(r);
    c:=(5/4)*r ;
   writeln('Suhu Celcius:  ',c:2:0);
end
 else if pil=3 then
begin
clrscr;
 writeln( 'Konver Reamur ke Kelvin');
   writeln('============================');
   write('Suhu Reamur:  ');
   readln(r);
   k:=(5/4) *r +273 ;
   writeln('Suhu Kelvin:  ',k:2:0);
   end;
   readln;
 end.


outputnya;














Untuk suhu Kelvin;

uses crt;
var
c,f,r,k: real;
pil:byte;
begin
clrscr;
 writeln('   Menu konver Suhu Kelvin');
 writeln('==============================');
 writeln('1.Kelvin Ke Farenhit');
 writeln('2.Kelvin ke Celcius');
 writeln('3.Kelvin ke Reamur ');
 writeln('===============================');

 write('Pilihan :');
 readln(pil);
 if pil=1 then
 begin
   clrscr;
   writeln( 'Konver Kelvin ke Farenhit');
   writeln('============================');
   write('Suhu Kelvin:  ');readln(k);

   f:=(9/5) * (k- 273) + 32  ;
   writeln('Suhu Farenhit:  ',f:2:0);
 End
  else if pil=2 then
 begin
 clrscr;
  writeln( '  Konver Kelvin ke Celcius');
   writeln('============================');
   write('Suhu Kelvin:  ');
   readln(k);
    c:=k- 273;
   writeln('Suhu Celcius:  ',c:2:0);
end
 else if pil=3 then
begin
clrscr;
 writeln( 'Konver Kelvin ke Reamur');
   writeln('============================');
   write('Suhu Kelvin:  ');
   readln(k);
   r:=(4/5) *(k - 273) ;
   writeln('Suhu Reamur:  ',r:2:0);
   end;
   readln;
 end.



dan outputnya;












Mungkin cukup sampai sini saja. Semoga bermanfaat.




Komentar