# Write a Pascal program. Calculate the sum of numbers from 19 to 51 if they are divisible by 5.

June 30, 2021 | education

| 1st option:

Pascal (for)

var sum: integer;

i: integer;

begin

sum: = 0;

i: = 0;

for i: = 19 to 51 do

begin

if i mod 5 = 0 then

sum: = sum + i;

end;

writeln (sum);

end.

2nd option:

Pascal

var sum: integer;

i: integer;

begin

sum: = 0;

i: = 19;

while (i <= 51) do

begin

if i mod 5 = 0 then

sum: = sum + i;

i: = i + 1;

end;

writeln (sum);

end.