Anda di halaman 1dari 2

Source Code

UAP.pas Program TingkatPolusiAir; Uses crt; var sungai:array[1..10] of string; o:array[1..10] of integer; b:array[1..10] of integer; bod:array[1..10] of real; hasil:array[1..10] of string; i,n:integer; Procedure NamaSungai; begin for i:=1 to n do begin Writeln('Masukkan data sungai ke: ',i); write('Sungai: '); readln(sungai[i]); write('Banyak jenis organisme yang hidup: '); readln(o[i]); Write('Kadar bakteri Escherichia Coli (koloni/ml): '); readln(b[i]); Write('Kadar BOD (mg/l): '); readln(bod[i]); end; end; Procedure Perhitungan; begin for i:=1 to n do begin if (o[i]>=25)and(b[i]<=10)and(bod[i]>=100) then hasil[i]:='Air bebas polusi' else if ((o[i]>=15)and(o[i]<25))and((b[i]>10)and(b[i]<=150))and((bod [i]>=75)and(bod[i]<100)) then hasil[i]:='Kadar ketercemaran sedang' else if ((o[i]>5)and(o[i]<15))and((b[i]>150)and(b[i]<1000))and((bod[ i]>30)and(bod[i]<75)) then hasil[i]:='Kadar ketercemaran besar' else if (o[i]<=5)and(b[i]>=1000)and(bod[i]<=30) then hasil[i]:='Kadar ketercemaran sangat besar,air tidak layak pakai' else hasil[i]:='Data yang Anda masukkan tidak memenuhi kriteria'; end;

end; procedure cetak; var i:integer; begin writeln('No. Sungai Organisme Bakteri(koloni/ml) BOD(mg/l) Hasil'); for i:=1 to n do writeln(i,sungai[i]:10,o[i]:10,b[i]:10,bod[i]:23:2,' ',hasil[i]); end; begin write('Masukkan jumlah sungai (maksimal 10) : '); readln(n); NamaSungai; Perhitungan; Writeln; Cetak; Readln; end.

Hasil Compile