PROGRAM MENGETAHUI NILAI SUATU RESISTOR

program resistor;
uses wincrt;
var
nilai:real;
n1,n2,n3,n4,nilaimax,nilaimin:real;
g1,g2,g3,g4:string;

begin
writeln('PROGRAM MENGETAHUI NILAI SUATU RESISTOR');
writeln('NAMA : AFIT MIRANTO');
writeln('NPM : G1D009001');
writeln('TEKNIK ELEKTRO UNIVERSITAS BENGKULU');
writeln(' ');
writeln('tulis warna gelang resistor dengan huruf kecil semua');

write('warna gelang 1= ');readln(g1);
write('warna gelang 2= ');readln(g2);
write('warna gelang 3= ');readln(g3);
write('warna gelang 4= ');readln(g4);

if (g1='hitam') then n1:= 0;
if (g1='coklat') then n1:=10;
if (g1='merah') then n1:=20;
if (g1='oranye') then n1:=30;
if (g1='kuning') then n1:=40;
if (g1='hijau') then n1:=50;
if (g1='biru') then n1:=60;
if (g1='ungu') then n1:=70;
if (g1='abu-abu')then n1:=80;
if (g1='putih') then n1:=90;

if (g2='hitam') then n2:=0;
if (g2='coklat') then n2:=1;
if (g2='merah') then n2:=2;
if (g2='oranye') then n2:=3;
if (g2='kuning') then n2:=4;
if (g2='hijau') then n2:=5;
if (g2='biru') then n2:=6;
if (g2='ungu') then n2:=7;
if (g2='abu-abu')then n2:=7;
if (g2='putih') then n2:=9;

if (g3='hitam') then n3:=1;
if (g3='coklat') then n3:=10;
if (g3='merah') then n3:=100;
if (g3='oranye') then n3:=1000;
if (g3='kuning') then n3:=10000;
if (g3='hijau') then n3:=100000;
if (g3='biru') then n3:=1000000;
if (g3='ungu') then n3:=10000000;
if (g3='abu-abu')then n3:=100000000;
if (g3='putih') then n3:=1000000000;
if (g3='perak') then n3:=0.01;
if (g3='emas') then n3:=0.1;

if (g4='perak') then n4:=10/100;
if (g4='emas') then n4:=5/100;


nilai:=((n1+n2)*n3);
nilaimax:=nilai+n4;
nilaimin:=nilai-n4;
writeln('nilai resistor = ',nilai :2:2,' ohm');
writeln('toleransi +/- ',n4:2:2);
writeln('nilai max resistor = ',nilaimax:2:2,' ohm');
writeln('nilai min resistor = ',nilaimin:2:2,' ohm');

readln;

donewincrt;
end.

Categories:

0 comments:

Post a Comment