Siwy
Gaduła
Dołączył: 02 Gru 2007
Posty: 93
Przeczytał: 0 tematów
|
Wysłany: Wto 9:19, 04 Gru 2007 Temat postu: Lista 5 zad 4 - mgr H |
|
|
program prog4;
{$APPTYPE CONSOLE}
uses
SysUtils;
var
d:array[1..100] of integer;
a,b,i,j:byte;
o:char;
begin
randomize;
repeat
a:=0;
b:=0;
for i:=1 to 100 do
begin
d[i]:=random (11)-5;
if (d[i]=0) then
repeat
d[i]:=random (11)-5;
until (d[i]<>0);
if d[i]=-5 then inc(a);
if d[i]=5 then inc (b);
write(d[i]:4);
end;
writeln ('Liczbe -5 wylosowano ',a,' razy');
writeln ('Liczbe 5 wylosowano ',b,' razy');
writeln;
writeln;
writeln ('Zakonczyc program [Z] czy powtorzyc [P]?');
readln (o);
while (upcase (o)<>'Z') and (upcase (o)<>'P') do
begin
writeln ('Wcisnij "Z" by zakonczyc lub "P" by powtorzyc');
readln (o);
end;
until upcase (o)='Z';
end.
|
|