Помогите написать 3 программы на паскале №2,5,9

Помогите написать 3 программы на паскале №2,5,9
Гость
Ответ(ы) на вопрос:
Гость
№2 var   a, b, n, max: integer;   begin   writeln('Введите a, b: ');   read(a, b);   assign(input, 'input.txt'); reset(input);   max := 0;   while not(eof(input)) do   begin     read(n);     if (max < n) and (n >= a) and (n <= b) then       max := n;   end;   writeln(max);   close(input); end. №5 var   n, max, count: integer;   begin   assign(input, 'input.txt'); reset(input);   count := 0;   max := 0;   while not(eof(input)) do   begin     read(n);     if n > max then     begin       count := 1;       max := n;     end     else if n = max then       inc(count);   end;   writeln(count);   close(input); end. №9 var   n, countOfPositive1, countOfPositive2, countOfNegative1, countOfNegative2, countOfZeros1, countOfZeros2: integer;   begin   countOfPositive1 := 0;   countOfPositive2 := 0;   countOfNegative1 := 0;   countOfNegative2 := 0;   countOfZeros1 := 0;   countOfZeros2 := 0;     assign(input, 'input1.txt'); reset(input);   while not(eof(input)) do   begin     read(n);     if n > 0 then inc(countOfPositive1)     else if n = 0 then inc(countOfZeros1)     else inc(countOfNegative1)   end;   close(input);     assign(input, 'input2.txt'); reset(input);   while not(eof(input)) do   begin     read(n);     if n > 0 then inc(countOfPositive2)     else if n = 0 then inc(countOfZeros2)     else inc(countOfNegative2)   end;   close(input);     if countOfPositive1 > countOfPositive2 then writeln('В первом файле больше положительных значений, чем во втором.')   else if countOfPositive1 = countOfPositive2 then writeln('В файлах одинаковое количество положительных значений.')   else writeln('Во втором файле больше положительных значений, чем в первом.');     if countOfNegative1 > countOfNegative2 then writeln('В первом файле больше отрицательных значений, чем во втором.')   else if countOfNegative1 = countOfNegative2 then writeln('В файлах одинаковое количество отрицательных значений.')   else writeln('Во втором файле больше отрицательных значений, чем в первом.');     if countOfZeros1 > countOfZeros2 then writeln('В первом файле больше нулевых значений, чем во втором.')   else if countOfZeros1 = countOfZeros2 then writeln('В файлах одинаковое количество нулевых значений.')   else writeln('Во втором файле больше нулевых значений, чем в первом.'); end.
Не нашли ответ?
Ответить на вопрос
Похожие вопросы