Program fifo;
02 uses crt;
03 var
04 x:array[1..100] of integer;
05 y:array[1..100] of integer;
06 z:array[1..100] of integer;
07 i,jum,n,t,jum2 : integer;
08
09 begin
10 clrscr;
11 t:=0;
12 jum:=0;
13 write('Masukkan proses = ');readln(n);
14 for i:= 1 to n do
15 begin
16 write('Proses ke-',i,' = ');readln(x[i]);
17 y[i]:=t;
18 z[i]:=x[i]+y[i];
19 jum:=jum+y[i];
20 jum2:=jum2+z[i];
21 t:=x[i]+t;
22 end;
23 writeln('===================================================');
24 writeln('Proses | CPU Time | Waiting Time | TAT ');
25 writeln('===================================================');
26 for i:=1 to n do
27 begin
28 writeln(' P',i,' ',x[i],' ',y[i],' ',z[i]);
29 end;
30 writeln('===================================================');
31 writeln(' Rata-rata = ',' ',jum/n:4:2,' ',jum2/n:4:2);
32 readln;
33 end.
Tidak ada komentar:
Posting Komentar