Запишите на языке паскаль программу решения задачи. Считайте количество жильцов дома случайным числом из диапазона от 50 до 200 человек, а число домов n=30.
var n, totalResidents, randomResidents, i: integer;
begin randomize; n := 30; totalResidents := 0;
for i := 1 to n do begin randomResidents := random(151) + 50; writeln('Number of residents in house ', i, ': ', randomResidents); totalResidents := totalResidents + randomResidents; end;
writeln('Total number of residents in all houses: ', totalResidents); end.
program HouseResidents;
var
n, totalResidents, randomResidents, i: integer;
begin
randomize;
n := 30;
totalResidents := 0;
for i := 1 to n do
begin
randomResidents := random(151) + 50;
writeln('Number of residents in house ', i, ': ', randomResidents);
totalResidents := totalResidents + randomResidents;
end;
writeln('Total number of residents in all houses: ', totalResidents);
end.