I have problem. If condition in for loop is checking only once. What's the problem? Here is my code:
program Planas;
function skaiciuoti() : integer;
var z, zz, d, dt, dp, i, sk : integer;
Fr, Fw : text;
begin
Assign(Fr, 'Duomenys.txt');
Reset(Fr);
ReadLn(Fr, d, z);
zz := 0;
dt := d;
for i := 1 to d do
begin
Read(Fr, sk);
zz := zz + sk;
if sk >= z then
dt := d - 1;
end;
z := d * z - zz;
dp := z div d;
if z mod d <> 0
then dp := dp + 1;
Close(Fr);
WriteLn(dt);
WriteLn(z);
WriteLn(dp);
end;
begin
skaiciuoti();
Readln;
end.
P.S Thank you for your answers in advance! :)
P.S.S Programming language is Pascal
Aucun commentaire:
Enregistrer un commentaire